/* ========================================================================== 
 * CaptainGreek Premium PDP — Phase 8E transactional hotfix
 * 2026-07-14
 *
 * Loaded after Phase 8D. It makes the CaptainGreek selection state the sole
 * visual owner per Magento swatch attribute and keeps the numeric input
 * compatible with the storefront's existing strict quantity guard.
 * ======================================================================= */

/* Phase 8D intentionally supported native .selected and aria-checked states.
   When a third-party swatch update left one of those states stale, two cards
   could look selected. Phase 8E renders selection only from the normalized
   data-cg-selected state and explicitly neutralizes stale native siblings. */
body.catalog-product-view.cg-pdp-premium-phase8e
.cg-pdp-premium.cg-pdp-premium--phase8e
#product-options-wrapper .swatch-option[data-cg-selected="false"],
body.catalog-product-view.cg-pdp-premium-phase8e
.cg-pdp-premium.cg-pdp-premium--phase8e
#product-options-wrapper .swatch-option.selected[data-cg-selected="false"],
body.catalog-product-view.cg-pdp-premium-phase8e
.cg-pdp-premium.cg-pdp-premium--phase8e
#product-options-wrapper .swatch-option[aria-checked="true"][data-cg-selected="false"] {
    border-color: var(--cg8d-line) !important;
    background: var(--cg8d-surface) !important;
    color: var(--cg8d-ink) !important;
    box-shadow: 0 6px 18px rgba(17, 26, 63, .045) !important;
}

body.catalog-product-view.cg-pdp-premium-phase8e
.cg-pdp-premium.cg-pdp-premium--phase8e
#product-options-wrapper .swatch-option[data-cg-selected="false"] .cg-pdp-variant-option__check,
body.catalog-product-view.cg-pdp-premium-phase8e
.cg-pdp-premium.cg-pdp-premium--phase8e
#product-options-wrapper .swatch-option.selected[data-cg-selected="false"] .cg-pdp-variant-option__check,
body.catalog-product-view.cg-pdp-premium-phase8e
.cg-pdp-premium.cg-pdp-premium--phase8e
#product-options-wrapper .swatch-option[aria-checked="true"][data-cg-selected="false"] .cg-pdp-variant-option__check {
    border-color: rgba(17, 26, 63, .11) !important;
    background: #f6f5f0 !important;
    color: transparent !important;
}

body.catalog-product-view.cg-pdp-premium-phase8e
.cg-pdp-premium.cg-pdp-premium--phase8e
#product-options-wrapper .swatch-option[data-cg-selected="true"] {
    border-color: rgba(180, 139, 49, .88) !important;
    background: #fffdf8 !important;
    color: var(--cg8d-ink) !important;
    box-shadow: 0 0 0 1px rgba(180, 139, 49, .14),
                0 10px 24px rgba(17, 26, 63, .08) !important;
}

body.catalog-product-view.cg-pdp-premium-phase8e
.cg-pdp-premium.cg-pdp-premium--phase8e
#product-options-wrapper .swatch-option[data-cg-selected="true"] .cg-pdp-variant-option__check {
    border-color: var(--cg8d-ink) !important;
    background: var(--cg8d-ink) !important;
    color: #f2d47d !important;
}

/* Keep native option behavior clear and predictable for mouse, touch, and
   keyboard users. */
body.catalog-product-view.cg-pdp-premium-phase8e
.cg-pdp-premium.cg-pdp-premium--phase8e
#product-options-wrapper .swatch-option {
    touch-action: manipulation !important;
}

/* The Phase 8E quantity template removes the Firefox-incompatible beforeinput
   interceptor. The native number input can now accept 10/20/100 while the new
   input/commit guard still rejects a standalone zero and non-digits. */
body.catalog-product-view.cg-pdp-premium-phase8e
.cg-pdp-premium.cg-pdp-premium--phase8e
#product_addtocart_form #qty[data-cg-qty-guard="phase8e"] {
    appearance: textfield !important;
    -moz-appearance: textfield !important;
    font-variant-numeric: tabular-nums !important;
}

body.catalog-product-view.cg-pdp-premium-phase8e
.cg-pdp-premium.cg-pdp-premium--phase8e
#product_addtocart_form #qty[data-cg-qty-guard="phase8e"]::-webkit-outer-spin-button,
body.catalog-product-view.cg-pdp-premium-phase8e
.cg-pdp-premium.cg-pdp-premium--phase8e
#product_addtocart_form #qty[data-cg-qty-guard="phase8e"]::-webkit-inner-spin-button {
    margin: 0 !important;
    -webkit-appearance: none !important;
}
