/* Sewandgrow — WAPF compact add-on rows.
   Scoped under `body.sng-compact-addons .wapf-field-multi-image-swatch` for
   specificity 0,3,1 — beats Avada's `.woocommerce form .form-row label` (0,2,2)
   and WAPF's own `.wapf-swatch--image` (0,1,0) without `!important`. */

/* ============================================================
   Kalam font, latin subset only (weight 400 + 700).
   Embedded as @font-face here (instead of relying on the
   Google Fonts CSS link) because LiteSpeed's font optimisation
   silently strips external Google Fonts <link> tags on prod —
   even with data-no-optimize="1". Embedding in our own CSS
   means LiteSpeed bundles these rules in like any other CSS
   content and the browser correctly fetches the woff2 from
   gstatic.com.
   See [[sewandgrow-prod-lazybg-wapf-totals]] note for context.
   ============================================================ */
@font-face {
  font-family: 'Kalam';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(https://fonts.gstatic.com/s/kalam/v18/YA9dr0Wd4kDdMthROCfhsCkA.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Kalam';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(https://fonts.gstatic.com/s/kalam/v18/YA9Qr0Wd4kDdMtDqHTLMkiQqtbGs.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}


body.sng-compact-addons .wapf-field-multi-image-swatch .wapf-image-swatch-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    overflow: hidden;
    max-width: 560px;
}

body.sng-compact-addons .wapf-field-multi-image-swatch .wapf-swatch--image {
    display: block;
    padding: 0;
    border: none;
    background: none;
    box-shadow: none;
}

/* FIX 1 — flex order: visually rearrange row to [thumb] [info] [price] [button].
   DOM order is unchanged (input stays first child of label so WAPF's native
   label-to-input click association and `change` event continue to fire). */
body.sng-compact-addons .wapf-field-multi-image-swatch .wapf-swatch--image > label > .sng-swatch-thumb { order: 1; }
body.sng-compact-addons .wapf-field-multi-image-swatch .wapf-swatch--image > label > .sng-swatch-info  { order: 2; }
body.sng-compact-addons .wapf-field-multi-image-swatch .wapf-swatch--image > label > .sng-swatch-price {
    order: 3;
    margin-left: auto;  /* push price (and following button) to the right */
}
body.sng-compact-addons .wapf-field-multi-image-swatch .wapf-swatch--image > label > input[type="checkbox"] { order: 4; }

body.sng-compact-addons .wapf-field-multi-image-swatch .wapf-swatch--image > label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    margin: 0;
    cursor: pointer;
    border-bottom: 1px solid #f1f3f5;
    min-height: 64px;
    transition: background-color 120ms ease, color 120ms ease;
}

body.sng-compact-addons .wapf-field-multi-image-swatch .wapf-swatch--image:last-child > label {
    border-bottom: none;
}

/* Hover styles apply only when the row is NOT already checked. Checked state
   is the dominant visual; layering hover on top of it produces unreadable
   combinations (white text on light peach). */
body.sng-compact-addons .wapf-field-multi-image-swatch .wapf-swatch--image > label:not(:has(input:checked)):hover {
    background: #ee8585;
}

body.sng-compact-addons .wapf-field-multi-image-swatch .wapf-swatch--image > label:not(:has(input:checked)):hover .sng-swatch-name,
body.sng-compact-addons .wapf-field-multi-image-swatch .wapf-swatch--image > label:not(:has(input:checked)):hover .sng-swatch-code,
body.sng-compact-addons .wapf-field-multi-image-swatch .wapf-swatch--image > label:not(:has(input:checked)):hover .sng-swatch-price {
    color: #fff;
}

/* Hide the original plugin name/price block (`.wapf-swatch-label` contains a
   text node plus `.wapf-pricing-hint` span). The JS injects its own
   `.sng-swatch-info` + `.sng-swatch-price`, so the plugin's copy is redundant
   and visually duplicates the row. Hiding the parent also hides the price
   hint span automatically. */
body.sng-compact-addons .wapf-field-multi-image-swatch .wapf-swatch-label {
    display: none;
}

/* Custom checkbox = coral "+" circle (unchecked) → coral "✓" circle (checked).
   The native input stays in the DOM so WAPF's pricing/cart logic keeps firing
   on `change`. We restyle it with `appearance: none` + an inline-SVG
   `background-image` for the glyph. Pseudo-elements (`::before`/`::after`) are
   NOT supported on <input> in any major browser, so SVG is the only path that
   renders the glyph reliably. */
body.sng-compact-addons .wapf-field-multi-image-swatch .wapf-swatch--image input[type="checkbox"] {
    flex: 0 0 auto;
    /* WAPF's stock CSS uses position:absolute to hide the native checkbox in
       image-swatch mode. We need it back in the flex flow as a visible button. */
    position: static;
    appearance: none;
    -webkit-appearance: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background-color: #ee8585;
    opacity: 1;
    pointer-events: auto;
    clip: auto;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cline x1='10' y1='5' x2='10' y2='15' stroke='white' stroke-width='2.2' stroke-linecap='round'/%3E%3Cline x1='5' y1='10' x2='15' y2='10' stroke='white' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 16px 16px;
    margin: 0;
    cursor: pointer;
    transition: background-color 120ms ease, box-shadow 120ms ease;
}

body.sng-compact-addons .wapf-field-multi-image-swatch .wapf-swatch--image input[type="checkbox"]:checked {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpolyline points='5,10.5 9,14.5 15.5,6' fill='none' stroke='white' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* On row hover (solid coral bg) the coral button vanishes into the bg —
   invert to white-fill with coral glyph so it stays visible.
   Only applies when row is NOT also checked (checked state takes priority). */
body.sng-compact-addons .wapf-field-multi-image-swatch .wapf-swatch--image > label:not(:has(input:checked)):hover input[type="checkbox"] {
    background-color: #fff;
    box-shadow: inset 0 0 0 1.5px #ee8585;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cline x1='10' y1='5' x2='10' y2='15' stroke='%23ee8585' stroke-width='2.2' stroke-linecap='round'/%3E%3Cline x1='5' y1='10' x2='15' y2='10' stroke='%23ee8585' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E");
}

body.sng-compact-addons .wapf-field-multi-image-swatch .wapf-swatch--image img {
    width: 44px;
    height: 44px;
    object-fit: contain;
    flex: 0 0 44px;
    background: #fff;
    border-radius: 6px;
}

body.sng-compact-addons .wapf-field-multi-image-swatch .sng-swatch-info {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-width: 0;
    gap: 1px;
}

body.sng-compact-addons .wapf-field-multi-image-swatch .sng-swatch-name {
    font-size: 13px;
    line-height: 1.25;
    color: #1f2937;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.sng-compact-addons .wapf-field-multi-image-swatch .sng-swatch-code {
    font-size: 11px;
    line-height: 1.25;
    color: #878685;
    font-weight: 400;
    letter-spacing: .02em;
}

body.sng-compact-addons .wapf-field-multi-image-swatch .sng-swatch-price {
    flex: 0 0 auto;
    font-size: 14px;
    font-weight: 700;
    color: #ee8585;
    font-variant-numeric: tabular-nums;
}

body.sng-compact-addons .wapf-field-multi-image-swatch .wapf-swatch--image > label:has(input:checked) {
    background: #fde6e6;
}

body.sng-compact-addons .wapf-field-multi-image-swatch .wapf-swatch--image > label:has(input:checked) .sng-swatch-price {
    color: #ee8585;
}

@media (max-width: 640px) {
    body.sng-compact-addons .wapf-field-multi-image-swatch .wapf-image-swatch-wrapper {
        max-width: none;
        border-left: none;
        border-right: none;
        border-radius: 0;
        margin-left: -16px;
        margin-right: -16px;
    }
    body.sng-compact-addons .wapf-field-multi-image-swatch .wapf-swatch--image > label {
        padding: 10px 14px;
        gap: 10px;
        min-height: 60px;
    }
    body.sng-compact-addons .wapf-field-multi-image-swatch .sng-swatch-name {
        white-space: normal;
        font-size: 12px;
    }
    body.sng-compact-addons .wapf-field-multi-image-swatch .sng-swatch-code {
        font-size: 10px;
    }
}

/* FIX 2 — WAPF section-break titles ("Optional Feet", "Wide Table",
   "Embroidery Accessories"). Style the `.wapf-field-label` container with
   coral Kalam, uppercase + tracking, and a dashed underline that visually
   separates each group of swatches.
   Targeting both the container and its nested `<label>`/`<span>` because
   WAPF's markup is `<div class="wapf-field-label"><label><span>…</span></label></div>`
   and the inner elements have higher specificity from theme defaults. */
body.sng-compact-addons .wapf-field-multi-image-swatch .wapf-field-label {
    margin: 0;
    padding: 12px 14px 6px;
    border-bottom: 1px dashed #d1cac4;
}
body.sng-compact-addons .wapf-field-multi-image-swatch .wapf-field-label,
body.sng-compact-addons .wapf-field-multi-image-swatch .wapf-field-label label,
body.sng-compact-addons .wapf-field-multi-image-swatch .wapf-field-label span {
    /* If Kalam fails to load (slow conn, blocked, cache miss, font-optimizer
       interference), fall back to bold uppercase Poppins — still on-brand,
       still readable, never a calligraphic system font. */
    font-family: 'Kalam', 'Poppins', system-ui, sans-serif;
    font-weight: 700;
    font-size: 14px;
    color: #ee8585;
    text-transform: uppercase;
    letter-spacing: .08em;
    line-height: 1.3;
}
