/* ==========================================
   SINGLE PRODUCT
========================================== */

:root {
    /* Shopping-bag icon (masked, tinted via currentColor) */
    --phl-bag-icon: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='black'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='M6%202%203%206v14a2%202%200%200%200%202%202h14a2%202%200%200%200%202-2V6l-3-4z'/%3E%3Cpath%20d='M3%206h18'/%3E%3Cpath%20d='M16%2010a4%204%200%200%201-8%200'/%3E%3C/svg%3E");
}

.single-product .site-main {
    padding-block: var(--space-12);
}

.single-product div.product {
    max-width: var(--container-width);
    margin-inline: auto;
}

/* Product top section */

.single-product .product {
    display: grid;
    /* Cap the gallery column so the main image stays small (~460px) and never
       balloons on very wide screens; summary takes the rest. Tablet/mobile
       media queries below override these columns. */
    grid-template-columns: minmax(0, 660px) minmax(0, 1fr);
    gap: clamp(32px, 4vw, 64px);
    align-items: start;
}

/* ==========================================
   Product image area — native WooCommerce gallery
   (flexslider + jquery.zoom + PhotoSwipe), themed
   into an Amazon-style layout: vertical thumbnail
   rail on the left, main image on the right.
   All controls come from WooCommerce; no plugin/JS.
========================================== */

.single-product .woocommerce-product-gallery {
    position: relative;
    width: 100% !important;
    float: none !important;
    margin: 0 !important;
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    grid-template-areas: "thumbs main";
    gap: var(--space-4);
    align-items: start;
    opacity: 1 !important; /* WC fades the gallery in; keep visible if JS is slow */
}

/* Single-image product: no thumbnail rail, main image spans full width.
   :has() collapses the grid whether flexslider rendered one thumb or none. */
.single-product .woocommerce-product-gallery:not(:has(.flex-control-nav li + li)) {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "main";
}
.single-product .woocommerce-product-gallery:not(:has(.flex-control-nav li + li)) .flex-control-nav {
    display: none;
}

/* Main image column (flexslider viewport, or the bare wrapper before JS).
   No card — image sits directly on the page. overflow:hidden keeps flexslider's
   off-screen slides clipped. */
.single-product .woocommerce-product-gallery .flex-viewport,
.single-product .woocommerce-product-gallery__wrapper {
    grid-area: main;
    margin: 0;
    overflow: hidden;
    border-radius: var(--radius-md);
}

.single-product .woocommerce-product-gallery__image {
    line-height: 0;
}

.single-product .woocommerce-product-gallery__image img {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    margin-inline: auto;
}

/* --- Thumbnail rail (flexslider control nav) --- */
.single-product .woocommerce-product-gallery .flex-control-thumbs {
    grid-area: thumbs;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    margin: 0;
    padding: 0;
    list-style: none;
}

.single-product .woocommerce-product-gallery .flex-control-thumbs li {
    width: 100%;
    margin: 0;
    float: none;
    list-style: none;
}

.single-product .woocommerce-product-gallery .flex-control-thumbs img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    padding: 3px;
    background: var(--color-white);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    opacity: 1;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.single-product .woocommerce-product-gallery .flex-control-thumbs img:hover {
    border-color: var(--color-primary);
}

/* Currently-selected thumbnail (flexslider sets .flex-active). */
.single-product .woocommerce-product-gallery .flex-control-thumbs img.flex-active,
.single-product .woocommerce-product-gallery .flex-control-thumbs .flex-active img {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px var(--color-primary-light);
}

/* --- Zoom / expand trigger (opens the PhotoSwipe lightbox) --- */
.single-product .woocommerce-product-gallery__trigger {
    position: absolute;
    top: var(--space-3);
    right: var(--space-3);
    z-index: 3;
    width: 44px;
    height: 44px;
    margin: 0;
    padding: 0;
    border-radius: var(--radius-full);
    background-color: var(--color-white);
    background-image: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='22'%20height='22'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='%232563EB'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Ccircle%20cx='11'%20cy='11'%20r='7'/%3E%3Cline%20x1='21'%20y1='21'%20x2='16.65'%20y2='16.65'/%3E%3Cline%20x1='11'%20y1='8'%20x2='11'%20y2='14'/%3E%3Cline%20x1='8'%20y1='11'%20x2='14'%20y2='11'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
    text-indent: -9999px;
    overflow: hidden;
    transition: background-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

.single-product .woocommerce-product-gallery__trigger:hover {
    background-color: var(--color-primary);
    background-image: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='22'%20height='22'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='%23FFFFFF'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Ccircle%20cx='11'%20cy='11'%20r='7'/%3E%3Cline%20x1='21'%20y1='21'%20x2='16.65'%20y2='16.65'/%3E%3Cline%20x1='11'%20y1='8'%20x2='11'%20y2='14'/%3E%3Cline%20x1='8'%20y1='11'%20x2='14'%20y2='11'/%3E%3C/svg%3E");
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

/* --- Gallery prev/next arrows (flexslider directionNav; auto-hidden at 1 image).
   The nav is a grid sibling of the viewport, so place it in the main column and
   center the arrows over the image rather than the thumbnail rail. --- */
.single-product .woocommerce-product-gallery .flex-direction-nav {
    grid-area: main;
    position: relative;
    align-self: stretch;
    margin: 0;
    padding: 0;
    list-style: none;
    pointer-events: none;
    z-index: 3;
}
.single-product .woocommerce-product-gallery .flex-direction-nav a {
    position: absolute;
    pointer-events: auto;
    top: 50%;
    transform: translateY(-50%);
    z-index: 3;
    width: 40px;
    height: 40px;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    background: var(--color-white);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
    color: var(--color-heading);
    font-size: 0; /* hide flexslider's "Previous"/"Next" label; keep the chevron */
    text-indent: 0;
    opacity: 0;
    transition: opacity var(--transition-fast), background var(--transition-fast), color var(--transition-fast);
}
.single-product .woocommerce-product-gallery:hover .flex-direction-nav a {
    opacity: 1;
}
.single-product .woocommerce-product-gallery .flex-direction-nav a::before {
    content: "";
    width: 11px;
    height: 11px;
    border-top: 2px solid currentColor;
    border-right: 2px solid currentColor;
}
.single-product .woocommerce-product-gallery .flex-direction-nav a.flex-prev { left: var(--space-3); }
.single-product .woocommerce-product-gallery .flex-direction-nav a.flex-next { right: var(--space-3); }
.single-product .woocommerce-product-gallery .flex-direction-nav a.flex-prev::before { transform: rotate(-135deg); margin-left: 4px; }
.single-product .woocommerce-product-gallery .flex-direction-nav a.flex-next::before { transform: rotate(45deg); margin-right: 4px; }
.single-product .woocommerce-product-gallery .flex-direction-nav a:hover {
    background: var(--color-primary);
    color: var(--color-white);
}
.single-product .woocommerce-product-gallery .flex-direction-nav a.flex-disabled {
    opacity: 0 !important;
}

/* PhotoSwipe lightbox: tint the counter + caption to the brand blue. */
.pswp__caption__center { text-align: center; }
.pswp__counter { color: var(--color-primary-light); }

/* Product information */

.single-product .summary {
    width: 100% !important;
    float: none !important;
    margin: 0 !important;
}

/* Title */

.single-product .summary .product_title {
    margin: 0 0 var(--space-3);
    font-size: clamp(32px, 4vw, 42px);
    line-height: 1.1;
    font-weight: var(--font-weight-bold);
    color: var(--color-black);
}

/* Rating */

.single-product .summary .woocommerce-product-rating {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin: 0 0 var(--space-4);
}

.single-product .summary .star-rating {
    color: var(--color-primary);
    font-size: var(--font-size-base);
}

.single-product .summary .woocommerce-review-link {
    color: var(--color-text-light);
    font-size: var(--font-size-sm);
    text-decoration: none;
}

.single-product .summary .woocommerce-review-link:hover {
    text-decoration: underline;
}

/* Price */

/* .woocommerce anchor raises specificity above WC core's
   `div.product p.price {color:#958e09}` (0,3,2), which otherwise wins. */
.woocommerce.single-product .summary .price,
.woocommerce.single-product .summary .woocommerce-variation-price .price {
    margin: 0;
    color: #000;
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-semibold);
    line-height: 1.2;
}

/* Inherit colour and weight so WC's/theme's price accent + bold don't win */
.single-product .summary .price .amount {
    color: inherit;
    font-weight: inherit;
}

/* Equal space above/below the price. WooCommerce ships 1em margins on every
   variation wrapper (description / price / availability / single_variation),
   which stack into a big gap above the price. Zero the whole subtree, then
   the gap ABOVE comes from form.cart's flex gap and the gap BELOW from the
   qty-row margin-top — both var(--space-4). */
.single-product .single_variation_wrap,
.single-product .summary .woocommerce-variation,
.single-product .summary .woocommerce-variation-description,
.single-product .summary .woocommerce-variation-price,
.single-product .summary .woocommerce-variation-availability {
    margin: 0;
    padding: 0;
}

/* Lift the price above the Pack Size selector. Flatten .single_variation_wrap
   so the price and the qty-row become direct flex children of form.cart, then
   order the price first. (WC's JS toggles .single_variation / the add-to-cart
   row, not the wrap, so display:contents here is safe.) */
.single-product .single_variation_wrap {
    display: contents;
}

.single-product .summary .woocommerce-variation {
    order: -1;
}

.single-product .summary .price del {
    color: var(--color-text-light);
    font-weight: var(--font-weight-normal);
    font-size: var(--font-size-xl);
    margin-right: var(--space-2);
}

.single-product .summary .price ins {
    text-decoration: none;
}

/* Hide the parent variable-product price range; the per-variation price
   (rendered inside .variations_form) is what we show instead. Scope to
   variable products only — simple products have no variation price, so their
   .summary > .price is the only price and must stay visible. */
.single-product .product-type-variable .summary > .price {
    display: none;
}

/* ==========================================
   VARIATION PILLS
========================================== */

/* Native select + Clear link stay in the DOM but hidden; the pill buttons
   built from the select's options are what the user interacts with.
   Broad anchors + !important because WC's variation JS re-shows the reset
   link inline. */
.single-product .variations_form select,
.single-product .reset_variations {
    display: none !important;
}

/* Un-table the variations rows so the label sits above the pills */
.single-product .variations_form .variations,
.single-product .variations_form .variations tbody,
.single-product .variations_form .variations tr,
.single-product .variations_form .variations th,
.single-product .variations_form .variations td {
    display: block;
    width: auto;
    margin: 0;
    padding: 0;
    text-align: left;
}

/* Pack Size heading hidden per design */
.single-product .variations_form .variations .label {
    display: none;
}

.single-product .phl-variation-pills {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4);
    margin-bottom: 0;
}

.single-product .phl-variation-pill {
    flex: 1 1 0;
    min-width: 110px;
    min-height: 44px;
    padding: var(--space-2) var(--space-5);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-white);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-medium);
    color: var(--color-heading);
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.single-product .phl-variation-pill:hover {
    border-color: var(--color-black);
}

.single-product .phl-variation-pill.is-active {
    border-color: var(--color-black);
    background: var(--color-black);
    color: var(--color-white);
}

/* ==========================================
   QUANTITY + PURCHASE BUTTONS
========================================== */

.single-product .summary form.cart {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    margin-top: var(--space-6);
}

/* Quantity + Add to cart share one row; Buy it now wraps below full-width. */
.single-product .woocommerce-variation-add-to-cart,
.single-product .summary form.cart:not(.variations_form) {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: var(--space-4);
    align-items: stretch;
}


/* Quantity stepper box */
.single-product .summary .quantity {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    margin: 0;
    height: 48px;
    padding: 0 var(--space-1);
    background: var(--color-background-light);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
}

.single-product .summary .quantity .qty {
    width: 40px;
    height: auto;
    padding: 0;
    border: 0;
    background: transparent;
    text-align: center;
    font-family: var(--font-family-base);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-medium);
    -moz-appearance: textfield;
    appearance: textfield;
}

.single-product .summary .quantity .qty::-webkit-outer-spin-button,
.single-product .summary .quantity .qty::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.single-product .phl-qty-btn {
    width: 32px;
    height: 32px;
    border: 0;
    background: transparent;
    color: var(--color-text-light);
    font-size: var(--font-size-xl);
    line-height: 1;
    cursor: pointer;
    transition: color 0.15s ease;
}

.single-product .phl-qty-btn:hover {
    color: var(--color-heading);
}

/* Add to cart — black, with bag icon, fills the rest of the row.
   Also matches the Quick View modal (.phl-qv-content has .summary but no
   .single-product ancestor), so it never falls back to WooCommerce's purple. */
.single-product .summary .single_add_to_cart_button,
.phl-qv-content .single_add_to_cart_button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    flex: 1 1 auto;
    min-height: 56px;
    padding: 0 var(--space-6);
    border: 0;
    border-radius: var(--radius-full);
    background: var(--color-black) !important;
    color: var(--color-white) !important;
    font-family: var(--font-family-base);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-normal);
    cursor: pointer;
    transition: opacity .2s ease;
}

.single-product .summary .single_add_to_cart_button::before,
.phl-qv-content .single_add_to_cart_button::before {
    content: "";
    width: 18px;
    height: 18px;
    background: currentColor;
    -webkit-mask: var(--phl-bag-icon) center / contain no-repeat;
    mask: var(--phl-bag-icon) center / contain no-repeat;
}

.single-product .summary .single_add_to_cart_button:hover,
.phl-qv-content .single_add_to_cart_button:hover {
    opacity: .9;
}

/* After add-to-cart: blue "View cart" link that takes the add-to-cart slot */
.phl-qv-view-cart {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 1 1 auto;
    min-height: 56px;
    padding: 0 var(--space-6);
    border-radius: var(--radius-full);
    background: var(--color-primary);
    color: var(--color-white);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-normal);
    text-decoration: none;
    transition: opacity .2s ease;
}

.phl-qv-view-cart:hover {
    opacity: .9;
    color: var(--color-white);
}

/* ==========================================
   BUY NOW
========================================== */

.phl-buy-now {
    flex: 1 0 100%;
    width: 100%;
    min-height: 56px;
    border: 0;
    border-radius: var(--radius-full);
    background: var(--color-primary);
    color: var(--color-white);
    font-family: var(--font-family-base);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-normal);
    cursor: pointer;
    transition: opacity .2s ease;
}

.phl-buy-now:hover {
    opacity: .9;
}

.phl-buy-now.disabled {
    opacity: .45;
    cursor: not-allowed;
}

/* Tags / product meta removed from the product summary */
.single-product .product_meta {
    display: none;
}

/* ==========================================
   SALE BADGE
   Perfect circle. Control it here: change --sale-size to resize,
   background to recolour. WooCommerce's default lets the "Sale!"
   text stretch the badge into an oval — fixed equal width/height
   forces a true circle.
========================================== */
.woocommerce span.onsale {
    --sale-size: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: var(--sale-size);
    height: var(--sale-size);
    min-width: 0;
    min-height: 0;
    padding: 0;
    line-height: 1;
    border-radius: 50%;
    background: var(--color-primary);
    color: var(--color-white);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
}

/* ==========================================
   PRODUCT TRUST FEATURES
========================================== */

.single-product .phl-product-trust {
    display: flex;
    flex-wrap: nowrap;
    width: 100%;
    margin-top: var(--space-6);
    gap: var(--space-3);
}

.single-product .phl-trust-item {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: row;
    align-items: center;
    text-align: left;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-background-light);
}

.single-product .phl-trust-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.single-product .phl-trust-icon {
    flex-shrink: 0;
    font-size: 28px;
    line-height: 1;
}

.single-product .phl-trust-title {
    color: var(--color-secondary);
    font-size: 13px;
    font-weight: var(--font-weight-semibold);
    line-height: 1.2;
}

.single-product .phl-trust-sub {
    color: var(--color-text-light);
    font-size: 11px;
    line-height: 1.3;
}

/* ==========================================
   CART / STORE NOTICES
========================================== */

.woocommerce-message,
.woocommerce-info,
.woocommerce-error {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin: 0 0 var(--space-6);
    padding: var(--space-4) var(--space-5);
    background: var(--color-background-light);
    border: 1px solid var(--color-border);
    border-left-width: 4px;
    border-radius: var(--radius-md);
    color: var(--color-heading);
    font-size: var(--font-size-sm);
    line-height: 1.4;
    list-style: none;
}

.woocommerce-message { border-left-color: #16a34a; }
.woocommerce-info    { border-left-color: var(--color-primary); }
.woocommerce-error   { border-left-color: #dc2626; }

/* Keep WooCommerce's status icon, but flow it inline with flex (not absolute) */
.woocommerce-message::before,
.woocommerce-info::before,
.woocommerce-error::before {
    position: static;
    top: auto;
    left: auto;
    margin: 0;
    font-size: 18px;
    line-height: 1;
}

.woocommerce-message::before { color: #16a34a; }
.woocommerce-info::before    { color: var(--color-primary); }
.woocommerce-error::before   { color: #dc2626; }

/* View cart / action button — pushed right, styled like the theme buttons.
   Uses a.button + !important to beat WooCommerce core's own button rules. */
.woocommerce-message a.button,
.woocommerce-info a.button,
.woocommerce-error a.button {
    order: 2;
    margin-left: auto !important;
    float: none !important;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0 var(--space-5) !important;
    border: 0 !important;
    border-radius: var(--radius-md) !important;
    background: var(--color-black) !important;
    color: var(--color-white) !important;
    font-family: var(--font-family-base);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    text-decoration: none;
    transition: opacity .2s ease;
}

.woocommerce-message a.button:hover,
.woocommerce-info a.button:hover,
.woocommerce-error a.button:hover {
    opacity: .9;
    background: var(--color-black) !important;
    color: var(--color-white) !important;
}

/* ==========================================
   MOBILE
========================================== */

@media (max-width: 768px) {

    .single-product .site-main {
        padding-block: var(--space-8);
    }

    .single-product .product {
        grid-template-columns: 1fr;
        gap: var(--space-6);
    }

    /* Reset the hero column placements so image → summary → sections truly stack. */
    .single-product div.product > .woocommerce-product-gallery,
    .single-product div.product > .summary {
        grid-column: 1;
    }

    /* Mobile: single column — main image on top, thumbnails scroll horizontally
       below it. Swipe between images is handled natively by flexslider. */
    .single-product .woocommerce-product-gallery {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            "main"
            "thumbs";
        gap: var(--space-3);
    }

    .single-product .woocommerce-product-gallery .flex-control-thumbs {
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 2px;
        -webkit-overflow-scrolling: touch;
    }

    .single-product .woocommerce-product-gallery .flex-control-thumbs li {
        flex: 0 0 88px;
    }

    /* Arrows stay visible on touch (no hover). */
    .single-product .woocommerce-product-gallery .flex-direction-nav a {
        opacity: 1;
        width: 36px;
        height: 36px;
    }

    /* Add to cart drops full-width below the quantity stepper. */
    .single-product .summary .single_add_to_cart_button {
        flex: 1 0 100%;
    }

    /* Keep all three features on one row; stack each card's content
       (icon on top, text centered below) so nothing clips at phone widths. */
    .single-product .phl-product-trust {
        flex-wrap: nowrap;
        gap: var(--space-2);
        margin-top: var(--space-5);
    }

    .single-product .phl-trust-item {
        flex: 1 1 0;
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: var(--space-1);
        padding: var(--space-3) var(--space-2);
    }

    .single-product .phl-trust-icon {
        font-size: 22px;
    }

    .single-product .phl-trust-title {
        font-size: 12px;
    }

    .single-product .phl-trust-sub {
        font-size: 10px;
    }

    /* Let the notice button drop below the text on narrow screens */
    .woocommerce-message,
    .woocommerce-info,
    .woocommerce-error {
        flex-wrap: wrap;
    }

    .woocommerce-message .button,
    .woocommerce-info .button,
    .woocommerce-error .button {
        margin-left: 0;
        width: 100%;
        justify-content: center;
    }

}

/* Tablet: keep two columns but equal + tighter gap so neither side gets narrow. */
@media (min-width: 769px) and (max-width: 1023px) {
    .single-product .product {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: 32px;
    }
}

/* ==========================================
   PRODUCT LAYOUT

   Hero row: image (col 1) + summary/buy box (col 2). EVERYTHING below the hero
   — description tabs, Before & After, reviews, You May Also Like — spans the
   full container width so no content is trapped in the narrow right column.
   min-width:0 lets grid children shrink instead of forcing overflow.
========================================== */

/* Hero two-column placement is desktop/tablet only. On mobile the grid is a
   single column (see the max-width:768px block above) and items must flow in
   DOM order — gallery → summary → tabs → before-after — so NO explicit
   grid-column/grid-row here, or the summary lands in a phantom 2nd column and
   the whole page overflows to the right. */
@media (min-width: 769px) {
    .single-product div.product > .woocommerce-product-gallery {
        grid-column: 1;
        grid-row: 1;
    }

    .single-product div.product > .summary {
        grid-column: 2;
        grid-row: 1;
    }
}

.single-product div.product > .woocommerce-product-gallery,
.single-product div.product > .summary {
    min-width: 0;
}

/* Full-width sections below the hero. */
.single-product div.product > .phl-before-after,
.single-product div.product > .phl-product-reviews,
.single-product div.product > .phl-related,
.single-product div.product > .up-sells,
.single-product div.product > .related {
    grid-column: 1 / -1;
    width: 100%;
    min-width: 0;
}

.single-product div.product > .phl-product-reviews,
.single-product div.product > .up-sells,
.single-product div.product > .related {
    max-width: var(--container-width);
    margin-inline: auto;
}

/* Description / Additional info — full-width band, readable centered column. */
.single-product div.product > .woocommerce-tabs {
    grid-column: 1 / -1;
    width: 100%;
    max-width: 960px;
    min-width: 0;
    margin: var(--space-12) auto 0;
    padding-inline: 24px;
}

/* ==========================================
   DESCRIPTION / ADDITIONAL INFO TABS
   Clear heading hierarchy within the right-hand column.
========================================== */

/* Tab nav — minimal underline style (active = accent text + underline).
   Selectors are prefixed with .single-product.woocommerce div.product so they
   outrank WooCommerce core's boxed-tab CSS. */
.single-product.woocommerce div.product .woocommerce-tabs ul.tabs {
    margin: 0 0 var(--space-6);
    padding: 0;
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-6);
    border-bottom: 1px solid var(--color-border);
    background: transparent;
}

/* Neutralise WooCommerce's default boxed-tab chrome (the pill + rounded
   connectors drawn with borders and ::before/::after). */
.single-product.woocommerce div.product .woocommerce-tabs ul.tabs::before,
.single-product.woocommerce div.product .woocommerce-tabs ul.tabs li::before,
.single-product.woocommerce div.product .woocommerce-tabs ul.tabs li::after {
    display: none;
    content: none;
    border: 0;
}

.single-product.woocommerce div.product .woocommerce-tabs ul.tabs li {
    margin: 0;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
}

.single-product.woocommerce div.product .woocommerce-tabs ul.tabs li a {
    display: block;
    padding: 0 0 var(--space-3);
    margin-bottom: -1px; /* underline overlaps the nav baseline */
    border-bottom: 2px solid transparent;
    color: var(--color-text-light);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-medium);
    text-decoration: none;
    transition: color .2s ease, border-color .2s ease;
}

.single-product.woocommerce div.product .woocommerce-tabs ul.tabs li a:hover {
    color: var(--color-secondary);
}

.single-product.woocommerce div.product .woocommerce-tabs ul.tabs li.active a {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

.single-product .woocommerce-tabs .panel {
    margin: 0;
}

.single-product .woocommerce-tabs .panel > *:first-child {
    margin-top: 0;
}

.single-product .woocommerce-tabs .panel h2 {
    margin: var(--space-8) 0 var(--space-4);
    font-size: clamp(30px, 4vw, 44px);
    font-weight: var(--font-weight-bold);
    line-height: 1.12;
    color: var(--color-black);
}

.single-product .woocommerce-tabs .panel h3 {
    margin: var(--space-6) 0 var(--space-3);
    font-size: clamp(20px, 2.5vw, 26px);
    font-weight: var(--font-weight-semibold);
    line-height: 1.25;
    color: var(--color-heading);
}

.single-product .woocommerce-tabs .panel p,
.single-product .woocommerce-tabs .panel li {
    font-size: var(--font-size-lg);
    line-height: 1.75;
    color: var(--color-text);
}

.single-product .woocommerce-tabs .panel p {
    margin: 0 0 var(--space-4);
}

.single-product .woocommerce-tabs .panel ul {
    margin: 0 0 var(--space-4);
    padding-left: 1.25em;
}

.single-product .woocommerce-tabs .panel li {
    margin-bottom: var(--space-2);
}

/* Mobile: keep the two tab labels on one horizontal row and shrink the
   description body so it isn't oversized. Placed after the base tab rules so
   these win at equal specificity. */
@media (max-width: 768px) {
    /* Align the tabs section to the page gutter (same left edge as the trust
       cards). Placed after the desktop `.woocommerce-tabs { padding-inline:24px }`
       rule so it wins at equal specificity. */
    .single-product div.product > .woocommerce-tabs {
        padding-inline: 0;
        margin-top: var(--space-8);
    }

    .single-product.woocommerce div.product .woocommerce-tabs ul.tabs {
        flex-wrap: nowrap;
        gap: var(--space-4);
    }

    .single-product.woocommerce div.product .woocommerce-tabs ul.tabs li a {
        font-size: var(--font-size-sm);
        white-space: nowrap;
    }

    .single-product .woocommerce-tabs .panel p,
    .single-product .woocommerce-tabs .panel li {
        font-size: var(--font-size-base);
        line-height: 1.6;
    }

    .single-product .woocommerce-tabs .panel h2 {
        font-size: var(--font-size-2xl);
    }

    .single-product .woocommerce-tabs .panel h3 {
        font-size: var(--font-size-lg);
    }
}

/* ==========================================
   BEFORE & AFTER (single product)
========================================== */

.single-product .phl-before-after {
    padding-block: clamp(48px, 7vw, 70px);
    margin-top: var(--space-12);
    background: #252429;
}

.single-product .phl-before-after .before-after__inner {
    width: min(100% - 2rem, 1100px);
}

/* Light text for contrast on the dark background. */
.single-product .phl-before-after .before-after__eyebrow {
    color: rgba(255, 255, 255, 0.65);
}

.single-product .phl-before-after .before-after__title {
    color: #fff;
}

.single-product .phl-before-after .before-after__disclaimer {
    color: rgba(255, 255, 255, 0.6);
}

/* One centered "Before & After" heading, then the stacked pairs. */
.phl-ba-pairs {
    display: grid;
    gap: clamp(24px, 4vw, 48px);
}

/* ==========================================
   CUSTOMER REVIEWS — premium layout
========================================== */

.single-product .phl-product-reviews {
    margin-top: var(--space-12);
}

.single-product .phl-product-reviews #reviews {
    max-width: var(--container-width);
    margin-inline: auto;
    padding: clamp(32px, 5vw, 56px) var(--space-5);
}

/* Mobile: drop the inner horizontal padding so "Customer Reviews" and its
   content start at the container edge — flush with the product title and the
   Before & After band above. (Placed after the base rule so it wins the tie.) */
@media (max-width: 768px) {
    .single-product .phl-product-reviews #reviews {
        padding-inline: 0;
    }
}

/* --- Head: title + write button --- */
.single-product .phl-reviews-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.single-product .phl-reviews-head .woocommerce-Reviews-title {
    margin: 0;
    font-size: clamp(22px, 3vw, 30px);
    font-weight: var(--font-weight-semibold);
    letter-spacing: -0.02em;
    color: var(--color-heading);
}

.single-product .phl-reviews-subtitle {
    margin: var(--space-1) 0 0;
    color: var(--color-text-light);
    font-size: var(--font-size-base);
    line-height: 1.4;
}

/* .phl-write-review now reuses the hero button styles (btn btn-primary btn-lg
   hero__btn) from the markup; the class here is just the JS hook that opens the
   review dialog. flex-shrink:0 keeps it from squashing beside the heading. */
.single-product .phl-write-review {
    flex-shrink: 0;
}

/* --- Summary panel: score + rating breakdown --- */
.single-product .phl-rsum {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: clamp(24px, 5vw, 56px);
    padding: clamp(20px, 3vw, 28px) clamp(20px, 3vw, 32px);
    margin-bottom: var(--space-8);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-background-light);
}

.single-product .phl-rsum__score {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding-right: clamp(24px, 5vw, 56px);
    border-right: 1px solid var(--color-border);
}

.single-product .phl-rsum__avg {
    font-size: clamp(44px, 7vw, 56px);
    font-weight: var(--font-weight-bold);
    line-height: 1;
    letter-spacing: -0.03em;
    color: var(--color-heading);
}

.single-product .phl-rsum__score .star-rating {
    margin: var(--space-3) 0 var(--space-2);
    color: var(--color-primary);
    font-size: 1.05em;
}

.single-product .phl-rsum__count {
    color: var(--color-text-light);
    font-size: var(--font-size-sm);
    white-space: nowrap;
}

/* Breakdown bars */
.single-product .phl-rsum__bars {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 10px;
}

.single-product .phl-rsum__row {
    display: grid;
    grid-template-columns: 40px 1fr 32px;
    align-items: center;
    gap: var(--space-3);
}

.single-product .phl-rsum__rlabel {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    color: var(--color-text);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
}

.single-product .phl-rsum__rstar {
    color: var(--color-primary);
    font-size: 12px;
}

.single-product .phl-rsum__track {
    position: relative;
    height: 8px;
    border-radius: var(--radius-full);
    background: var(--color-border);
    overflow: hidden;
}

.single-product .phl-rsum__fill {
    position: absolute;
    inset: 0 auto 0 0;
    border-radius: var(--radius-full);
    background: var(--color-primary);
    transition: width var(--transition-slow);
}

.single-product .phl-rsum__rcount {
    text-align: right;
    color: var(--color-text-light);
    font-size: var(--font-size-sm);
    font-variant-numeric: tabular-nums;
}

/* Empty state */
.single-product .phl-reviews-empty {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    padding: clamp(28px, 4vw, 40px);
    margin-bottom: var(--space-8);
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-background-light);
    color: var(--color-text-light);
    text-align: center;
}

.single-product .phl-reviews-empty strong {
    color: var(--color-heading);
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
}

/* --- Review cards --- */
.single-product .phl-product-reviews .commentlist {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-4);
}

@media (max-width: 767px) {
    .single-product .phl-product-reviews .commentlist {
        grid-template-columns: minmax(0, 1fr);
    }
}

.single-product .phl-product-reviews .commentlist li.review {
    margin: 0;
}

.single-product .phl-review-card {
    padding: clamp(18px, 2.5vw, 24px);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-white);
    transition: border-color var(--transition-fast);
}

.single-product .phl-review-card:hover {
    border-color: #D8DEE7;
}

.single-product .phl-review-card__head {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
}

.single-product .phl-review-card__avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-full);
    background: var(--color-primary-light);
    color: var(--color-primary-hover);
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    text-transform: uppercase;
}

.single-product .phl-review-card__who {
    min-width: 0;
}

.single-product .phl-review-card__name {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-2);
    color: var(--color-heading);
    font-weight: var(--font-weight-semibold);
    line-height: 1.3;
}

.single-product .phl-review-card__verified {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    background: #E7F6EC;
    color: #067647;
    font-size: 11px;
    font-weight: var(--font-weight-semibold);
}

.single-product .phl-review-card__verified::before {
    content: "\2713";
}

.single-product .phl-review-card__sub {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-top: 3px;
}

.single-product .phl-review-card__sub .star-rating {
    margin: 0;
    color: var(--color-primary);
    font-size: 0.85em;
}

.single-product .phl-review-card__date {
    color: var(--color-text-light);
    font-size: var(--font-size-sm);
}

.single-product .phl-review-card__pending {
    margin: 0 0 var(--space-2);
    color: var(--color-warning);
    font-size: var(--font-size-sm);
}

.single-product .phl-review-card__body {
    color: var(--color-text);
    line-height: 1.7;
}

.single-product .phl-review-card__body p {
    margin: 0 0 var(--space-2);
}

.single-product .phl-review-card__body p:last-child {
    margin-bottom: 0;
}

/* --- Media gallery in a review --- */
.phl-review-media {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin: var(--space-3) 0 0;
}

.phl-review-media__item {
    position: relative;
    width: 76px;
    height: 76px;
    padding: 0;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--color-background-dark);
    cursor: pointer;
    transition: transform var(--transition-fast);
}

.phl-review-media__item:hover {
    transform: scale(1.03);
}

.phl-review-media__item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.phl-review-media__play {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 22px;
    background: rgba(0, 0, 0, .35);
}

/* --- Lightbox --- */
.phl-lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(17, 24, 39, .85);
}

.phl-lightbox.is-open {
    display: flex;
}

.phl-lightbox__media {
    max-width: 100%;
    max-height: 85vh;
    border-radius: var(--radius-md);
}

.phl-lightbox__close {
    position: absolute;
    top: 16px;
    right: 20px;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .15);
    color: #fff;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

/* --- Review form --- */
/* ==========================================
   WRITE-A-REVIEW DIALOG (native <dialog>)
========================================== */
.phl-review-dialog {
    width: min(560px, calc(100vw - 2rem));
    max-height: calc(100vh - 4rem);
    padding: clamp(20px, 4vw, 32px);
    border: 0;
    border-radius: var(--radius-lg);
    background: var(--color-white);
    overflow: auto;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
}

.phl-review-dialog::backdrop {
    background: rgba(0, 0, 0, 0.55);
}

.phl-review-dialog__close {
    position: sticky;
    top: 0;
    float: right;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin: -8px -8px 0 0;
    border: 0;
    border-radius: 50%;
    background: var(--color-background-light);
    color: var(--color-secondary);
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.phl-review-dialog__close:hover {
    background: var(--color-border);
    color: var(--color-black);
}

/* Inside the dialog the form is the only content — drop its stacking margin. */
.single-product .phl-product-reviews .phl-review-dialog #review_form_wrapper {
    margin-top: 0;
}

.single-product .phl-product-reviews #review_form_wrapper {
    margin-top: var(--space-8);
}

.single-product .phl-product-reviews #respond {
    width: 100%;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.single-product .phl-product-reviews .comment-reply-title {
    display: block;
    margin-bottom: var(--space-4);
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
    letter-spacing: -0.01em;
    color: var(--color-heading);
}

.single-product .phl-product-reviews #respond label {
    display: block;
    margin-bottom: 6px;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--color-heading);
}

.single-product .phl-product-reviews #respond input[type="text"],
.single-product .phl-product-reviews #respond input[type="email"],
.single-product .phl-product-reviews #respond select,
.single-product .phl-product-reviews #respond textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-white);
    font-family: inherit;
    font-size: var(--font-size-base);
    color: var(--color-text);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.single-product .phl-product-reviews #respond input[type="text"]:focus,
.single-product .phl-product-reviews #respond input[type="email"]:focus,
.single-product .phl-product-reviews #respond select:focus,
.single-product .phl-product-reviews #respond textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-light);
}

.single-product .phl-product-reviews #respond textarea {
    min-height: 120px;
    resize: vertical;
}

/* Two-up name/email on wider screens */
.single-product .phl-product-reviews #respond .comment-form-author,
.single-product .phl-product-reviews #respond .comment-form-email {
    margin: 0 0 var(--space-4);
}

@media (min-width: 640px) {
    .single-product .phl-product-reviews #respond .comment-form-author,
    .single-product .phl-product-reviews #respond .comment-form-email {
        display: inline-block;
        width: calc(50% - 8px);
        vertical-align: top;
    }
    .single-product .phl-product-reviews #respond .comment-form-author {
        margin-right: 16px;
    }
}

.single-product .phl-product-reviews #respond p {
    margin: 0 0 var(--space-4);
}

.single-product .phl-product-reviews #respond .comment-form-rating {
    margin-bottom: var(--space-4);
}

/* input#submit (2 IDs) needed to out-specify WooCommerce core's
   ".woocommerce #respond input#submit" grey button rule. */
.single-product .phl-product-reviews #respond input#submit {
    -webkit-appearance: none;
    appearance: none;
    width: auto;
    padding: 13px var(--space-8);
    border: 0;
    border-radius: var(--radius-md);
    background: var(--color-primary);
    color: var(--color-white);
    font-family: inherit;
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    line-height: 1.2;
    text-transform: none;
    letter-spacing: 0;
    cursor: pointer;
    transition: background var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
}

.single-product .phl-product-reviews #respond input#submit:hover {
    background: var(--color-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, .25);
}

.single-product .phl-product-reviews #respond input#submit:active {
    transform: translateY(0);
    box-shadow: none;
}

/* --- Cookies-consent: custom accent checkbox --- */
.single-product .phl-product-reviews #respond .comment-form-cookies-consent {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    margin: 0 0 var(--space-5);
}

.single-product .phl-product-reviews #respond .comment-form-cookies-consent input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    margin: 1px 0 0;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-xs);
    background: var(--color-white);
    cursor: pointer;
    transition: border-color var(--transition-fast), background var(--transition-fast);
}

.single-product .phl-product-reviews #respond .comment-form-cookies-consent input[type="checkbox"]:hover {
    border-color: var(--color-primary);
}

.single-product .phl-product-reviews #respond .comment-form-cookies-consent input[type="checkbox"]:checked {
    border-color: var(--color-primary);
    background: var(--color-primary) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23fff' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='3.5 8.5 6.5 11.5 12.5 4.5'/%3E%3C/svg%3E") center / 14px no-repeat;
}

.single-product .phl-product-reviews #respond .comment-form-cookies-consent input[type="checkbox"]:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--color-primary-light);
}

/* Override the block/bold form-label style for the consent label only. */
.single-product .phl-product-reviews #respond .comment-form-cookies-consent label {
    display: inline;
    margin: 0;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-normal);
    line-height: 1.5;
    color: var(--color-text-light);
    cursor: pointer;
}

/* --- Customer upload fields --- */
.phl-review-upload {
    display: grid;
    gap: var(--space-4);
    margin: 0 0 var(--space-4);
}

.phl-review-upload__label {
    display: block;
    margin-bottom: 4px;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--color-heading);
}

.phl-review-upload__hint {
    display: block;
    margin-top: 4px;
    color: var(--color-text-light);
    font-size: 12px;
}

.phl-review-upload input[type="file"] {
    width: 100%;
    padding: 12px 14px;
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-background-light);
    font-size: var(--font-size-sm);
    color: var(--color-text-light);
    cursor: pointer;
    transition: border-color var(--transition-fast);
}

.phl-review-upload input[type="file"]:hover {
    border-color: var(--color-primary);
}

.phl-review-upload__previews {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-top: var(--space-2);
}

.phl-review-upload__thumb {
    position: relative;
    width: 72px;
    height: 72px;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--color-background-dark);
    border: 1px solid var(--color-border);
}

.phl-review-upload__thumb img,
.phl-review-upload__thumb video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.phl-review-upload__remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    padding: 0;
    line-height: 18px;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, .6);
    color: #fff;
    font-size: 14px;
    cursor: pointer;
}

.phl-review-upload__error {
    width: 100%;
    color: var(--color-danger);
    font-size: 12px;
}

/* --- Responsive --- */
@media (max-width: 640px) {
    .single-product .phl-reviews-head {
        justify-content: flex-start;
    }
    .single-product .phl-write-review {
        width: 100%;
    }
    .single-product .phl-rsum {
        grid-template-columns: 1fr;
        gap: var(--space-5);
        text-align: center;
    }
    .single-product .phl-rsum__score {
        padding-right: 0;
        padding-bottom: var(--space-5);
        border-right: 0;
        border-bottom: 1px solid var(--color-border);
    }
    .single-product .phl-rsum__count {
        white-space: normal;
    }
}

/* ==========================================
   YOU MAY ALSO LIKE (all-products carousel)
========================================== */

.single-product .phl-related {
    /* No margin-top: the grid row-gap + the inner section's own top padding
       already separate this from the reviews above. */
    margin-top: 0;
}

.single-product .phl-related__inner {
    max-width: var(--container-width);
    margin-inline: auto;
    /* top trimmed: the grid row-gap + the reviews' own bottom padding already
       separate this section. Keep the generous bottom padding for the carousel. */
    padding: var(--space-4) 24px clamp(48px, 7vw, 70px);
}

.single-product .phl-related__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.single-product .phl-related__title {
    margin: 0;
    font-size: clamp(24px, 3vw, 34px);
    font-weight: var(--font-weight-semibold);
    color: var(--color-black);
}

.single-product .phl-related__subtitle {
    margin: var(--space-1) 0 0;
    color: var(--color-text-light);
    font-size: var(--font-size-base);
    line-height: 1.4;
}

.single-product .phl-related__nav {
    display: flex;
    gap: var(--space-2);
}

.single-product .phl-related__arrow {
    width: 40px;
    height: 40px;
    border: 1px solid var(--color-border);
    border-radius: 50%;
    background: var(--color-white);
    color: var(--color-heading);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    transition: background .2s ease, color .2s ease;
}

.single-product .phl-related__arrow:hover {
    background: var(--color-primary);
    color: var(--color-white);
    border-color: var(--color-primary);
}

/* Horizontal scroll-snap carousel — native, no library. */
.single-product .phl-related__track {
    display: flex;
    gap: var(--space-4);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    padding-bottom: var(--space-2);
    scrollbar-width: thin;
}

.single-product .phl-related__item {
    scroll-snap-align: start;
    /* ~5 per view on desktop, shrinking to ~2 on mobile via flex-basis. */
    flex: 0 0 clamp(220px, calc((100% - 4 * var(--space-4)) / 5), 300px);
}

.single-product .phl-related__item .product-card {
    height: 100%;
}

@media (max-width: 1023px) {
    .single-product .phl-related__item {
        flex-basis: clamp(200px, 40%, 260px);
    }
}

@media (max-width: 600px) {
    /* Tighten (but don't crush) the space around the reviews block: trim its
       big top margin down to a small gap and reduce its inner padding. The grid
       row-gap still separates it from Before & After above and the carousel. */
    .single-product .phl-product-reviews {
        margin-top: var(--space-4);
    }
    .single-product .phl-product-reviews #reviews {
        padding-block: var(--space-4);
    }
    .single-product .phl-related {
        margin-top: var(--space-4);
    }

    /* Align the section (title + cards) to the container edge — flush with
       "Customer Reviews" and the product title above. */
    .single-product .phl-related__inner {
        padding-top: 0;
        padding-inline: 0;
    }
    /* Narrower cards on mobile — the 1:1 image scales with width, so this also
       cuts the card height the square image would otherwise take. */
    .single-product .phl-related__item {
        flex-basis: 58%;
    }
    .single-product .phl-related__nav {
        display: none; /* touch-scroll on mobile */
    }
}

/* ==========================================
   PRODUCT LOADING SKELETON
   Fixed overlay rendered by phl_product_skeleton() (inc/woocommerce.php) and
   removed on window `load`. Toggle/tune via the phl_product_skeleton_* filters.
========================================== */
.phl-product-skeleton {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    justify-content: center;
    padding: 60px 1rem;
    background: var(--color-background, #fff);
    opacity: 1;
    transition: opacity .4s ease;
    overflow: hidden;
}

.phl-product-skeleton.is-hidden {
    opacity: 0;
    pointer-events: none;
}

.phl-skel__inner {
    display: grid;
    grid-template-columns: minmax(0, 560px) minmax(0, 1fr);
    gap: clamp(32px, 4vw, 64px);
    width: 100%;
    max-width: var(--container-width);
}

.phl-skel__media {
    aspect-ratio: 1 / 1;
    width: 100%;
    border-radius: var(--radius-md);
}

.phl-skel__summary {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    padding-top: var(--space-6);
}

.phl-skel__line { height: 20px; border-radius: 6px; }
.phl-skel__line--title { height: 40px; width: 90%; }
.phl-skel__line--title.is-short { width: 60%; }
.phl-skel__line--price { height: 28px; width: 40%; margin-top: var(--space-2); }

.phl-skel__row { display: flex; gap: var(--space-3); margin-top: var(--space-2); }
.phl-skel__pill { flex: 1 1 0; height: 56px; border-radius: var(--radius-md); }

.phl-skel__btn { height: 56px; border-radius: var(--radius-full); margin-top: var(--space-2); }

/* Shimmer — shared background for every placeholder block. */
.phl-skel__media,
.phl-skel__line,
.phl-skel__pill,
.phl-skel__btn {
    background: linear-gradient(100deg, #eceef1 30%, #f6f7f9 50%, #eceef1 70%);
    background-size: 200% 100%;
    animation: phl-skel-shimmer 1.4s ease-in-out infinite;
}

@keyframes phl-skel-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

@media (prefers-reduced-motion: reduce) {
    .phl-skel__media,
    .phl-skel__line,
    .phl-skel__pill,
    .phl-skel__btn { animation: none; }
}

@media (max-width: 768px) {
    .phl-skel__inner { grid-template-columns: 1fr; }
    .phl-skel__summary { padding-top: 0; }
}
