/* PDP-007: Configuration & Fit -- scoped presentation only.
   Colors/radii match the canonical design-system tokens (accent-brand
   #ed0678, zz-title-color #2f2f2f, zzs-swatch-border #d5d5d5,
   zz-input-border #e5e7eb, zz-input-bg #fafafa, zz-success-color #16a34a),
   ported as concrete values since those custom properties are not defined
   on real DEV. */

/* 1. Suppress the legacy inline "you may also like" upsells block that
   currently renders inside this acceptance region on the custom PDP
   layout (between price and the variation form). Presentation-only: the
   underlying upsell relationship is untouched and still feeds the Color
   Family strip below and the shop-loop swatch feature. */
.custom-product-page .up-sells.upsells-wrapper {
    display: none;
}

/* 1b. A separate, pre-existing [zsg] "Допомога з вибором розміру" trigger
   is also placed inline in this custom layout, right after price -- also
   not present at that position in the canonical Final, and now redundant
   with the correctly-positioned trigger this module renders after
   Diameter (zz-pdp-config-fithelp__trigger). Same treatment: presentation
   suppressed, underlying zigzag-size-guide shortcode/content untouched. */
.custom-product-page .zsg-link:not(.zz-pdp-config-fithelp__trigger) {
    display: none;
}

/* 1c. Price is explicitly inside this acceptance region ("price/
   availability area immediately after the locked Gallery"), and the
   canonical Final is explicit that price has no card/border/background
   ("price is information, not a control"). Real DEV applies a site-wide
   yellow pill style to every single-product price
   (zigzag-custom-css/assets/css/src/single-product.css:622,
   ".price.product-page-price > .woocommerce-Price-amount") -- overridden
   here, scoped to .single-product, back to plain canonical typography. */
/* PDP-007R2 OWNER_REJECTED_VISUAL_RECOVERY (VIS-PRICE-01): the rules below
   only ever restyled the price's inner nodes (.woocommerce-Price-amount /
   ins / del) -- the outer <p class="price ..."> itself kept its browser
   default paragraph bottom margin (~27px at this font-size), which is what
   real DEV computed layout showed was the actual remaining source of the
   Price -> Availability gap (confirmed via getComputedStyle: price margin-
   bottom 27.04px, unrelated to the already-fixed phantom-<p> siblings).
   Resetting it here lets margin collapse with availability's own 10px
   margin-top (section 6) produce the canonical ~10px relationship, with no
   fixed height/negative margin involved. */
.single-product .price.product-page-price {
    margin: 0;
}

.single-product .price.product-page-price > .woocommerce-Price-amount {
    display: inline;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
    color: #000000;
    font-family: "Inter", sans-serif;
    font-weight: 700;
    font-size: 31px;
    line-height: 1;
    letter-spacing: -0.01em;
    margin: 0;
}

.single-product .price.product-page-price > .woocommerce-Price-amount:hover {
    box-shadow: none;
}

.single-product .price.product-page-price > .woocommerce-Price-amount .woocommerce-Price-currencySymbol {
    font-style: normal;
    opacity: 1;
    margin-left: 0.15em;
}

/* 1d. PDP-007R2 final residual (RESIDUAL-02): sale price hierarchy. The
   1c rule above only ever matched `.price > .woocommerce-Price-amount`,
   a direct child -- on a sale price WooCommerce's own markup is
   `.price.price-on-sale > del > .woocommerce-Price-amount` and
   `> ins > .woocommerce-Price-amount`, one level deeper, so 1c never
   applied to sale prices at all and they fell through to unstyled
   defaults in native DOM order (regular/struck-through price first,
   current price second). WooCommerce always emits <del> (regular) before
   <ins> (current/sale) -- that DOM order is kept as-is (correct reading
   order for assistive tech), and only visually reversed with `flex` +
   `order` so the current price reads as the primary value first, exactly
   as it already is for a non-sale price. No pricing values are computed
   or duplicated here; every number still comes straight from
   WooCommerce's own price HTML. */
.single-product .price.product-page-price.price-on-sale {
    display: inline-flex;
    align-items: center;
}

.single-product .price.product-page-price.price-on-sale ins {
    order: 1;
    text-decoration: none;
    color: #000000;
    font-family: "Inter", sans-serif;
    font-weight: 700;
    font-size: 31px;
    line-height: 1;
    letter-spacing: -0.01em;
}

.single-product .price.product-page-price.price-on-sale del {
    order: 2;
    margin-left: 12px;
    color: #9aa0a6;
    font-family: "Inter", sans-serif;
    font-weight: 500;
    font-size: 18px;
    line-height: 1;
    opacity: 1;
}

/* PDP-007R2 OWNER_REJECTED_VISUAL_RECOVERY (VIS-PRICE-02): dynamic discount
   badge, appended server-side by
   zigzag_pdp_configuration_fit_filter_price_html() only when WooCommerce's
   own regular/current numeric prices confirm an active sale -- never
   hardcoded, never a separate pricing source. Sits after <del> in DOM
   order (matches the order this filter appends it in) and is placed last
   visually via flex `order` regardless of source order. */
.single-product .price.product-page-price.price-on-sale .zz-pdp-price-badge {
    order: 3;
    margin-left: 10px;
    display: inline-flex;
    align-items: center;
    box-sizing: border-box;
    height: 24px;
    padding: 0 6px;
    border-radius: 7px;
    background: rgba(178, 0, 0, 0.08);
    color: #b20000;
    font-family: "Inter", sans-serif;
    font-weight: 700;
    font-size: 13px;
    line-height: 1;
    white-space: nowrap;
}

.single-product .price.product-page-price.price-on-sale .woocommerce-Price-currencySymbol {
    font-style: normal;
    opacity: 1;
    margin-left: 0.15em;
}

@media (min-width: 1000px) {
    .single-product .price.product-page-price.price-on-sale ins {
        font-size: 28px;
    }

    .single-product .price.product-page-price.price-on-sale del {
        font-size: 16px;
    }
}

/* 1e. PDP-007R2 final residual (RESIDUAL-01): the custom UX-Builder
   layout's Price/Upsells/legacy-Fit-help content is auto-paragraphed by
   WordPress (wpautop), which wraps each of those shortcode outputs in a
   <p>. A <div> cannot nest inside a <p>, so browsers auto-close that <p>
   the instant the div starts, leaving an empty/near-empty phantom <p> as
   a direct sibling of the price container and the (already CSS-hidden,
   see rule 1) upsells block. `display: none` on the upsells div itself
   does not remove those phantom siblings -- their own default paragraph
   margin was the actual source of the "excessive" Desktop price ->
   availability gap the owner reported, not the price/availability rules
   themselves (confirmed by inspecting the real DEV markup: both phantoms
   are direct children of the exact .col-inner this module already tags
   as zz-pdp-desktop-info-col). Scoped to that one specific instance --
   added unconditionally by pdp-configuration-fit.js regardless of
   viewport, so this applies at every breakpoint -- rather than a bare
   `.col-inner` selector, so this never touches any other `.col-inner` on
   the page (e.g. inside each upsell product card). */
.zz-pdp-desktop-info-col > .col-inner > p {
    margin: 0;
}

/* 2. Availability line (relocated native stock text). */
.zz-pdp-config-availability {
    margin-top: 13px;
    margin-bottom: 4px;
}

.zz-pdp-config-availability .stock {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin: 0;
    padding: 0;
    font: 500 15px/1.2 "Inter", sans-serif;
    background: none;
    border: 0;
}

.zz-pdp-config-availability .stock:before {
    content: "";
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
    background-color: currentColor;
    -webkit-mask: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center / contain no-repeat;
}

.zz-pdp-config-availability .stock.in-stock {
    color: #16a34a;
}

.zz-pdp-config-availability .stock.out-of-stock,
.zz-pdp-config-availability .stock.available-on-backorder {
    color: #6b7280;
}

/* Native per-variation availability text still renders near the buy
   button (WooCommerce's own single_variation template); the relocated
   line above stays the single visible indicator and is kept in sync with
   it by pdp-configuration-fit.js. */
.single-product .woocommerce-variation-availability {
    display: none;
}

/* 3. Color Family strip. Graphite current outline, no checkmark, no pink
   (matches pdp-colorfamily-v1.6.15.jsx: ColorFamilyNav / FamilyTile). */
.zz-pdp-config-colorfamily {
    margin-top: 16px;
}

.zz-pdp-config-colorfamily__head {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 14px;
    font: 400 15px/1.2 "Lato", sans-serif;
}

.zz-pdp-config-colorfamily__label {
    font-weight: 700;
    color: #2f2f2f;
}

.zz-pdp-config-colorfamily__value {
    color: #2f2f2f;
}

.zz-pdp-config-colorfamily__tiles {
    display: flex;
    flex-wrap: wrap;
    gap: 11px;
}

.zz-pdp-config-colorfamily__tile {
    display: block;
    box-sizing: border-box;
    width: 80px;
    height: 80px;
    padding: 4px;
    background: #fff;
    border: 2px solid #d5d5d5;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
}

.zz-pdp-config-colorfamily__tile--current {
    border-color: #2f2f2f;
    cursor: default;
}

/* PDP-007R2 follow-up (owner-reported: Buy button visually stuck to the
   Color Family tiles on sale/simple products). For a variable product the
   spacing after Color Family is already owned by table.variations' own
   margin-top (24px/18px below); for a simple/no-variation product (e.g.
   the sale archetype) there is no variations table between Color Family
   and the native qty+Buy row, and form.cart itself carries no top margin,
   so that row rendered with zero gap (confirmed on real DEV:
   getBoundingClientRect() showed the tiles' bottom and form.cart's top at
   the exact same pixel). Scoped via the adjacent-sibling combinator so
   this only ever applies to that specific simple-product case, never to a
   variable product's form.variations_form. */
.zz-pdp-config-colorfamily + form.cart:not(.variations_form) {
    margin-top: 24px;
}

.zz-pdp-config-colorfamily__tile img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* 4. Thickness / Diameter -- re-skin the existing Flatsome .ux-swatch
   runtime (already renders as buttons on real DEV; no markup rewrite).
   Selected = pink border/bg/text (matches VariationChip). Disabled keeps
   Flatsome's native diagonal-strike treatment, muted to the canonical
   tone. Scoped to the single-product variation form only. */
.single-product .variations_form .ux-swatches {
    gap: 8px;
    margin: 0;
}

.single-product .variations_form .ux-swatches--circle .ux-swatch--label {
    border-radius: 10px;
}

.single-product .variations_form .ux-swatch--label {
    box-sizing: border-box;
    min-width: 53px;
    min-height: 45px;
    padding: 0 10px;
    box-shadow: none;
    border: 2px solid #d5d5d5;
    background: #fff;
    font: 400 16px/1 "Lato", sans-serif;
    color: #2f2f2f;
}

.single-product .variations_form .ux-swatch--label:hover:not(.selected):not(.disabled) {
    box-shadow: none;
    border-color: #9aa0a6;
}

.single-product .variations_form .ux-swatch.selected {
    box-shadow: none;
    border: 2px solid #ed0678;
    background: rgba(237, 6, 120, 0.06);
}

.single-product .variations_form .ux-swatch.selected .ux-swatch__text {
    color: #ed0678;
    font-weight: 700;
}

.single-product .variations_form .ux-swatch.selected:before {
    content: "";
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-right: 4px;
    background-color: #ed0678;
    -webkit-mask: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center / contain no-repeat;
}

.single-product .variations_form .ux-swatch--label.disabled {
    opacity: 1;
    border-color: #e5e7eb;
    color: #b6bcc4;
}

.single-product .variations_form .ux-swatch--label.disabled:not(.selected) .ux-swatch__text {
    text-decoration-line: line-through;
    text-decoration-thickness: 1px;
    text-decoration-color: currentColor;
    text-decoration-skip-ink: none;
}

.single-product .variations_form .variations {
    margin-top: 24px;
    margin-bottom: 0;
}

.single-product .variations_form .variations tbody tr {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    column-gap: 12px;
}

.single-product .variations_form .variations .label {
    display: block;
    order: 0;
    flex: 1 1 auto;
    min-width: 0;
    padding: 0 0 11px;
    border: 0;
    font: 700 16px/1.2 "Lato", sans-serif;
    color: #2f2f2f;
}

.single-product .variations_form .variations .label .zz-pdp-config-attribute-label {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    max-width: 100%;
}

.single-product .variations_form .variations .label .zz-pdp-config-attribute-label__icon {
    display: block;
    width: 16px;
    height: 16px;
    min-width: 16px;
    min-height: 16px;
    max-width: 16px;
    max-height: 16px;
    flex: 0 0 16px;
    color: #6b7280;
}

.single-product .variations_form .variations .value {
    display: contents;
    border: 0;
}

.single-product .variations_form .variations .value > .variation-selector,
.single-product .variations_form .variations .value > .ux-swatches {
    order: 2;
    flex: 1 0 100%;
}

.single-product .variations_form .variations .value > .ux-swatches {
    padding: 0 0 24px;
}

.single-product .variations_form .reset_variations {
    order: 1;
    flex: 0 0 auto;
    position: static !important;
    float: none !important;
    clear: none !important;
    align-self: flex-start;
    margin: 2px 0 0 auto;
    max-width: 100%;
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
}

/* 5. Fit-help row -- style the existing [zsg] trigger link as the
   canonical full-width bordered row (icon + label + chevron). The modal
   itself is zigzag-size-guide's own, untouched. */
.zz-pdp-config-fithelp {
    margin-top: 20px;
}

.zz-pdp-config-fithelp .zsg-link {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 48px;
    width: 100%;
    box-sizing: border-box;
    padding: 0 14px;
    background: #fafafa;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    text-decoration: none;
    color: #2f2f2f;
}

.zz-pdp-config-fithelp .zsg-link .zsg-ico {
    color: #ed0678;
    display: flex;
}

.zz-pdp-config-fithelp .zsg-link span:not(.zsg-ico) {
    flex: 1;
    font: 600 15.5px/1.3 "Lato", sans-serif;
}

.zz-pdp-config-fithelp .zsg-link:after {
    content: "";
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
    background-color: #9aa0a6;
    -webkit-mask: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='9 18 15 12 9 6'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='9 18 15 12 9 6'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* 6. Desktop only (>=1000px, above Flatsome's own 850px .large-6 cutoff so
   this never affects the 768px Tablet QA viewport): canonical Desktop
   uses a distinct, smaller "scale c" for Configuration controls
   (pdp-desk-hero-v1.40.jsx Chip40/ColorFamilyNav(scale="c")/
   MiddleColumn40), not the Mobile/Tablet "scale b" values above. */
@media (min-width: 1000px) {
    .single-product .price.product-page-price > .woocommerce-Price-amount {
        font-size: 28px;
    }

    .zz-pdp-config-availability {
        margin-top: 10px;
    }

    .zz-pdp-config-availability .stock {
        font-size: 14px;
    }

    .zz-pdp-config-colorfamily {
        margin-top: 0;
    }

    .zz-pdp-config-colorfamily__tile {
        width: 74px;
        height: 74px;
    }

    .zz-pdp-config-colorfamily__tiles {
        gap: 10px;
    }

    .single-product .variations_form .variations {
        margin-top: 18px;
    }

    .zz-pdp-config-colorfamily + form.cart:not(.variations_form) {
        margin-top: 18px;
    }

    .single-product .variations_form .ux-swatch--label {
        min-width: 46px;
        min-height: 40px;
        font-size: 14.5px;
    }

    .single-product .variations_form .ux-swatches--circle .ux-swatch--label {
        border-radius: 9px;
    }

    .single-product .variations_form .variations .value > .ux-swatches {
        padding-bottom: 16px;
    }

    .zz-pdp-config-fithelp {
        margin-top: 14px;
    }

    .zz-pdp-config-fithelp .zsg-link {
        min-height: 40px;
        padding: 0 12px;
    }

    .zz-pdp-config-fithelp .zsg-link span:not(.zsg-ico) {
        font-size: 13.5px;
    }

    .zz-pdp-config-fithelp .zsg-link:after {
        width: 14px;
        height: 14px;
    }
}

/* 7. Desktop three-column shell (Gallery | Configuration | Purchase,
   46fr/27fr/27fr per pdp-desk-hero-v1.40.jsx HeroD40). The live custom
   UX-Builder product layout only has two Flatsome grid columns (Gallery
   .large-6 | Info .large-6, the Info column carrying Title, Price,
   Configuration AND Purchase together) -- P1 macro gap from the first
   review pass.

   PDP-007R2 recovery: the prior candidate solved the Configuration/
   Purchase split by moving `.single_variation_wrap` out of
   `form.variations_form` via JS, which broke Add to Cart (WooCommerce's
   own variation-state CSS gating, and anything else on the page that
   assumes native controls stay inside their original form subtree,
   depend on `.single_variation_wrap` remaining a real DOM descendant of
   the form). This recovery keeps every native form intact and reaches
   the same visual split with CSS Grid `subgrid` instead:
   - Gallery/Info column widths: 46/54 (Configuration+Purchase's combined
     27+27 share), unchanged from the prior candidate;
   - the Info column's own content is a 2-column grid
     (Configuration | Purchase), unchanged;
   - `form.variations_form` itself spans both of those columns and
     becomes a subgrid, so ITS OWN children -- `table.variations` and
     `.zz-pdp-config-fithelp` in column 1 (Configuration), and the still
     fully intact `.single_variation_wrap` in column 2 (Purchase) -- align
     to the same tracks without leaving the form;
   - for simple/no-variation products there is no variations table to
     split off, so the whole (also untouched) `form.cart` goes directly
     into the Purchase column -- this also fixes the Desktop structural
     collapse simple products had under the prior candidate, whose
     Configuration/Purchase split only ever ran when `.variations_form`
     was present.
   The Gallery/Info columns are tagged by pdp-configuration-fit.js
   (zz-pdp-desktop-*-col classes) rather than matched here via CSS
   relational selectors against markup this module doesn't own (the
   UX-Builder layout's row/col ids are regenerated per product and were
   confirmed to differ between two real product pages); the form-level
   selectors below target WooCommerce's own stable classes directly, no
   JS tagging needed since nothing is moved. */
@media (min-width: 1000px) {
    .zz-pdp-desktop-gallery-col {
        flex-basis: 46%;
        max-width: 46%;
    }

    .zz-pdp-desktop-info-col {
        flex-basis: 54%;
        max-width: 54%;
    }

    .zz-pdp-desktop-info-col > .col-inner {
        display: grid;
        grid-template-columns: 1fr 1fr;
        column-gap: 24px;
        align-content: start;
    }

    .zz-pdp-desktop-info-col > .col-inner > * {
        grid-column: 1;
        min-width: 0;
    }

    /* Simple/no-variation products: no variations table to split off, so
       the whole native cart form is the Purchase column. */
    .zz-pdp-desktop-info-col > .col-inner > form.cart:not(.variations_form) {
        grid-column: 2;
        min-width: 0;
    }

    /* Variable products: the form spans both tracks and becomes a
       subgrid so its own children -- not the form itself -- are what
       actually split across Configuration/Purchase. Nothing is moved out
       of the form; `display: grid` + `subgrid` only change how its
       existing children are laid out. */
    .zz-pdp-desktop-info-col > .col-inner > form.variations_form {
        grid-column: 1 / 3;
        display: grid;
        grid-template-columns: subgrid;
        align-items: start;
        column-gap: 24px;
    }

    .zz-pdp-desktop-info-col > .col-inner > form.variations_form > table.variations {
        grid-column: 1;
    }

    .zz-pdp-desktop-info-col > .col-inner > form.variations_form > .zz-pdp-config-fithelp {
        grid-column: 1;
    }

    .zz-pdp-desktop-info-col > .col-inner > form.variations_form > .single_variation_wrap {
        grid-column: 2;
        grid-row: 1 / -1;
        align-self: start;
        min-width: 0;
    }
}
