/* Shared product primitives. Both storefront templates load this source. */
body:is(.p-product-mobile, .p-product-desktop, .p-product-desktop-page),
#product.p-product-ui,
.p-product-calculator,
.p-product-calculator-dialog,
.p-attribute-popover {
    /* Canonical palette. Desktop, mobile and portaled dialogs consume these roles. */
    --p-white: #fff;
    --p-text: #17232e;
    --p-text-secondary: #34434b;
    --p-text-muted: #5f6b75;
    --p-surface: #f5f6f8;
    --p-surface-hover: #edf1f4;
    --p-border: #e7ebed;
    --p-border-strong: #c8d3d8;
    --p-brand: #0f8f7a;
    --p-green-strong: #0b7c69;
    --p-green-hover: #086a59;
    --p-green-soft: #eff8f4;
    --p-green-soft-hover: #e3f3ec;
    --p-error: #ad2929;
    --p-error-soft: #fff2f1;
    --p-rating: #ffad16;
    --p-selection: #d5eee3;
    --p-font-family: var(--mp-storefront-font, Arial, Helvetica, sans-serif);

    /* Compatibility aliases retain existing component APIs; no second palette. */
    --p-ink: var(--p-text);
    --p-muted: var(--p-text-muted);
    --p-green: var(--p-brand);
    --p-mint: var(--p-green-soft);
    --p-line: var(--p-border);
    --p-purchase-ink: var(--p-text);
    --p-purchase-muted: var(--p-text-muted);
    --p-purchase-line: var(--p-border);
    --p-purchase-mint: var(--p-green-soft);
    --p-purchase-green: var(--p-green-strong);
    --p-cart-start: var(--p-action-top);
    --p-cart-end: var(--p-action-bottom);
    --p-cart-hover: var(--p-action-edge);
    --p-hit-start: #ed2c97;
    --p-hit-end: #f57980;
}

/* Same labeled save/compare actions in both storefront templates. */
#product.p-product-ui .p-product-secondary { position: static; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: center; gap: 8px; width: 100%; margin: 8px 0 0; padding: 0; }
#product.p-product-ui .p-product-secondary > span { position: static; display: block; min-width: 0; margin: 0; padding: 0; }
#product.p-product-ui .p-product-secondary button { position: relative; display: flex; align-items: center; justify-content: center; gap: 7px; box-sizing: border-box; width: 100%; min-height: 44px; margin: 0; padding: 8px 5px; border: 0; border-radius: 10px; background: transparent; color: var(--p-text-muted); font: 600 12px/18px var(--p-font-family); letter-spacing: 0; text-transform: none; cursor: pointer; touch-action: manipulation; }
#product.p-product-ui .p-product-secondary__label { white-space: nowrap; }
/* Legacy selected icon backgrounds use !important; inline original geometry owns this row. */
#product.p-product-ui .p-product-secondary .p-product-secondary__icon { display: grid; place-items: center; flex: 0 0 20px; width: 20px; height: 20px; margin: 0; background: none !important; color: inherit; filter: none; }
#product.p-product-ui .p-product-secondary__icon::before,
#product.p-product-ui .p-product-secondary__icon::after { content: none; display: none; }
#product.p-product-ui .p-product-secondary__icon svg { display: block; width: 20px; height: 20px; }
#product.p-product-ui .p-product-secondary button[aria-pressed="true"] { background: var(--p-green-soft); color: var(--p-green-strong); }
/* The shop reset sets outline:none!important on every element. */
#product.p-product-ui .p-product-secondary button:focus-visible { outline: 2px solid var(--p-green-strong) !important; outline-offset: 2px; }
@media (hover: hover) {
    #product.p-product-ui .p-product-secondary button:hover { background: var(--p-surface); color: var(--p-text); }
    #product.p-product-ui .p-product-secondary button[aria-pressed="true"]:hover { background: var(--p-green-soft-hover); color: var(--p-green-strong); }
}

/* Keep native +/- glyphs legible instead of inheriting the legacy white hover fill. */
#product.p-product-ui .p-page__calculator-inputs .quantity-b svg path { fill: currentColor; }
@media (hover: hover) {
    #product.p-product-ui .p-page__calculator-inputs .quantity-b:not(:disabled):hover { color: var(--p-green-strong); background: var(--p-green-soft); }
}

/* Attribute help uses one viewport-bound popover, outside table clipping contexts. */
#product.p-product-ui .p-attribute-help { display: inline-flex; align-items: center; vertical-align: middle; margin-left: 5px; }
#product.p-product-ui .p-attribute-help__trigger { position: relative; display: inline-flex; align-items: center; justify-content: center; flex: none; box-sizing: border-box; width: 16px; min-width: 16px; height: 16px; min-height: 16px; margin: 0; padding: 0; border: 1px solid var(--p-border-strong); border-radius: 50%; background: var(--p-green-soft); color: var(--p-green-strong); cursor: pointer; vertical-align: middle; touch-action: manipulation; }
#product.p-product-ui .p-attribute-help__trigger::after { position: absolute; inset: -14px; content: ''; }
#product.p-product-ui .p-attribute-help__trigger svg { display: block; width: 12px; height: 12px; pointer-events: none; }
#product.p-product-ui .p-attribute-help__trigger[aria-expanded="true"] { border-color: var(--p-green-strong); background: var(--p-green-strong); color: var(--p-white); }
#product.p-product-ui .p-attribute-help__trigger:focus-visible { outline: 2px solid var(--p-green-strong) !important; outline-offset: 3px; }
.p-attribute-popover { position: fixed; z-index: 1100; display: flex; flex-direction: column; box-sizing: border-box; width: min(360px, calc(100vw - 24px)); max-height: min(420px, calc(100dvh - 24px)); margin: 0; padding: 0; border: 0; border-radius: 14px; background: var(--p-white); color: var(--p-text); box-shadow: 0 8px 30px #17232e24; font: 400 14px/1.5 var(--p-font-family); text-align: left; letter-spacing: 0; }
.p-attribute-popover[hidden] { display: none; }
.p-attribute-popover::before { position: absolute; left: calc(var(--p-help-arrow-left, 24px) - 5px); width: 10px; height: 10px; background: var(--p-white); transform: rotate(45deg); content: ''; pointer-events: none; }
.p-attribute-popover[data-placement="bottom"]::before { top: -5px; }
.p-attribute-popover[data-placement="top"]::before { bottom: -5px; }
.p-attribute-popover__header { position: relative; flex: none; min-height: 52px; padding: 14px 56px 10px 16px; }
.p-attribute-popover__header h3 { margin: 0; color: var(--p-text); font: 700 14px/20px var(--p-font-family); overflow-wrap: anywhere; }
.p-attribute-popover [data-p-attribute-help-close] { position: absolute; top: 8px; right: 8px; display: grid; place-items: center; width: 36px; height: 36px; margin: 0; padding: 0; border: 0; border-radius: 50%; background: var(--p-surface); color: var(--p-text-secondary); cursor: pointer; touch-action: manipulation; }
.p-attribute-popover [data-p-attribute-help-close]::after { position: absolute; inset: -4px; content: ''; }
.p-attribute-popover [data-p-attribute-help-close] svg { width: 16px; height: 16px; pointer-events: none; }
.p-attribute-popover__content { flex: 1 1 auto; min-height: 0; margin: 0; padding: 0 16px 16px; overflow: auto; overscroll-behavior: contain; overflow-wrap: anywhere; scrollbar-width: thin; scrollbar-color: var(--p-border-strong) var(--p-surface); }
.p-attribute-popover__content :is(p, ul, ol, blockquote, table, .filter-attribute-description) { margin: 0 0 12px; }
.p-attribute-popover__content :is(p, ul, ol, blockquote, table, .filter-attribute-description):last-child { margin-bottom: 0; }
.p-attribute-popover__content :is(ul, ol) { padding-left: 20px; }
.p-attribute-popover__content :is(.f-title, h4, strong) { color: var(--p-text); font-weight: 700; }
.p-attribute-popover__content .f-title { margin: 10px 0 4px; }
.p-attribute-popover__content :is(img, video, iframe, table) { max-width: 100%; }
.p-attribute-popover__content img { display: block; height: auto; }
.p-attribute-popover__content a { color: var(--p-green-strong); text-decoration: underline; text-underline-offset: 3px; }
.p-attribute-popover :is(button, a):focus-visible { outline: 2px solid var(--p-green-strong) !important; outline-offset: 2px; }
@media (hover: hover) {
    #product.p-product-ui .p-attribute-help__trigger:not([aria-expanded="true"]):hover { border-color: var(--p-green-strong); background: var(--p-green-soft-hover); }
    .p-attribute-popover [data-p-attribute-help-close]:hover { background: var(--p-green-soft); color: var(--p-green-strong); }
}

/* Shared semantic specification icons keep their labels visible on both layouts. */
#product.p-product-ui .p-spec-icon {
    display: block;
    flex: none;
    width: 24px;
    height: 24px;
    color: var(--p-green-strong);
}
#product.p-product-ui .p-spec-label { display: flex; align-items: flex-start; gap: 7px; }
#product.p-product-ui .p-spec-label > span { min-width: 0; }
#product.p-product-ui .p-spec-label .p-spec-icon { width: 16px; height: 16px; margin-top: 1px; }
#product.p-product-desktop .pdp-quick-specs > .pdp-quick-spec--with-icon { position: relative; padding-left: 43px; }
#product.p-product-desktop .pdp-quick-specs .p-spec-icon { position: absolute; top: calc(50% - 12px); left: 11px; }

/* Product metadata is the same component in both storefront templates. */
#product.p-product-ui .p-sku-chip {
    position: relative;
    display: inline-flex;
    align-items: center;
    box-sizing: border-box;
    gap: 5px;
    width: fit-content;
    max-width: 100%;
    min-height: 25px;
    margin: 0;
    padding: 4px 9px;
    border: 0;
    border-radius: 9px;
    background: var(--p-mint);
    color: var(--p-text-muted);
    font: 400 10px/15px var(--p-font-family);
    letter-spacing: 0;
    text-transform: none;
}
#product.p-product-ui .p-sku-chip > span { min-width: 0; overflow-wrap: anywhere; }
#product.p-product-ui .p-sku-chip strong { color: var(--p-text); font: inherit; font-weight: 700; }
#product.p-product-ui .p-sku-chip .p-sku-barcode { flex: none; width: 14px; height: 14px; color: var(--p-text-muted); }
#product.p-product-ui .p-sku-chip .p-sku-copy {
    display: grid;
    place-items: center;
    flex: none;
    width: 20px;
    height: 25px;
    min-width: 20px;
    min-height: 25px;
    margin: -4px -5px -4px 0;
    padding: 0;
    border: 0;
    border-radius: 4px;
    background: none;
    color: var(--p-text-muted);
    cursor: pointer;
}
#product.p-product-ui .p-sku-chip .p-sku-copy svg { display: block; width: 15px; height: 15px; }
#product.p-product-ui .p-sku-chip .p-sku-copy [data-copy-check] { display: none; }
#product.p-product-ui .p-sku-chip .p-sku-copy[data-copy-complete] { color: var(--p-green-strong); }
#product.p-product-ui .p-sku-chip .p-sku-copy[data-copy-complete] [data-copy-icon] { display: none; }
#product.p-product-ui .p-sku-chip .p-sku-copy[data-copy-complete] [data-copy-check] { display: block; }
#product.p-product-ui .p-sku-chip .p-sku-copy:focus-visible { outline: 2px solid var(--p-green); outline-offset: 2px; }
#product.p-product-ui .p-sku-chip .p-sku-feedback {
    position: absolute;
    left: 0;
    bottom: calc(100% + 5px);
    z-index: 8;
    width: max-content;
    max-width: min(290px, calc(100vw - 30px));
    white-space: normal;
    background: var(--p-white);
    color: var(--p-green-strong);
    font: 400 10px/15px var(--p-font-family);
}
@media (hover: hover) {
    #product.p-product-ui .p-sku-chip .p-sku-copy:hover { color: var(--p-green); }
}

/* Plain campaign stickers share their markup, dimensions and palette. */
#product.p-product-ui .p-gallery-badges > .p-product-sticker {
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    flex: none;
    width: fit-content;
    min-width: 0;
    max-width: none;
    height: auto;
    min-height: 27px;
    margin: 0;
    padding: 5px 12px;
    border: 0;
    border-radius: 18px;
    color: var(--p-white);
    font: 500 10px/14px var(--p-font-family);
    letter-spacing: 0;
    text-transform: none;
    white-space: nowrap;
}
#product.p-product-ui .p-gallery-badges > .p-product-sticker.i--novelty { background: linear-gradient(90deg, #2a6ff5 -2%, #e064f4 116.55%); }
#product.p-product-ui .p-gallery-badges > .p-product-sticker.i--hit { background: linear-gradient(110deg, var(--p-hit-start), var(--p-hit-end)); }
#product.p-product-ui .p-gallery-badges > .p-product-sticker.i--discount { background: linear-gradient(90deg, #f52a42 -2%, #f4dd64 116.55%); }

/* Independent property disclosures: reference circles with semantic active colors. */
#product.p-product-ui .p-gallery-badges {
    --p-badge-gradient: linear-gradient(115deg, #18c8ee 0%, #3677ff 100%);
    --p-badge-focus: #267bdf;
    --p-badge-tint: #edf4fd;
    --p-badge-shadow: #1769d72b;
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 14px;
    left: 15px;
    z-index: 6;
    width: 46px;
    gap: 4px;
    pointer-events: none;
}
#product.p-product-ui .p-gallery-badges > .p-list__overlay { pointer-events: auto; }
#product.p-product-ui .p-feature-badge {
    position: relative;
    width: 46px;
    flex: none;
    pointer-events: auto;
}
#product.p-product-ui .p-feature-badge.is--open { z-index: 12; }
#product.p-product-ui .p-feature-badge[data-badge-tone="eco"] {
    --p-badge-gradient: linear-gradient(115deg, #23cd90 0%, #00a98e 100%);
    --p-badge-focus: #008a66;
    --p-badge-tint: #e7f7ef;
    --p-badge-shadow: #00865e2b;
}
#product.p-product-ui .p-feature-badge[data-badge-tone="heat"] {
    --p-badge-gradient: linear-gradient(115deg, #ffb14b 0%, #ee792f 100%);
    --p-badge-focus: #bd601c;
    --p-badge-tint: #fff1e4;
    --p-badge-shadow: #bf66212b;
}
#product.p-product-ui .p-feature-badge__trigger {
    position: relative;
    z-index: 4;
    display: grid;
    place-items: center;
    box-sizing: border-box;
    width: 46px;
    height: 46px;
    min-height: 46px;
    margin: 0;
    padding: 0;
    border: 3px solid transparent;
    border-radius: 50%;
    background: #ffffff8c;
    color: var(--p-text);
    box-shadow: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    transition: background-color 180ms ease-out, border-color 180ms ease-out, box-shadow 180ms ease-out;
}
#product.p-product-ui .p-feature-badge__glyph {
    position: relative;
    display: block;
    width: 26px;
    height: 26px;
    overflow: hidden;
    pointer-events: none;
}
#product.p-product-ui .p-feature-badge__glyph img,
#product.p-product-ui .p-feature-badge__panel-icon img {
    position: absolute;
    top: 50%;
    left: 50%;
    display: block;
    width: 68px;
    height: 68px;
    max-width: none;
    max-height: none;
    margin: 0;
    transform: translate(-50%, -50%);
    object-fit: contain;
}
#product.p-product-ui .p-feature-badge__glyph img { width: 58px; height: 58px; filter: brightness(.25); opacity: .85; }
#product.p-product-ui .p-feature-badge__label {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
    white-space: nowrap;
    pointer-events: none;
}
#product.p-product-ui .p-feature-badge__chevron { display: none; }
#product.p-product-ui .p-feature-badge.is--open .p-feature-badge__trigger {
    border-color: var(--p-white);
    background: var(--p-badge-gradient);
    color: var(--p-white);
    box-shadow: 0 3px 14px var(--p-badge-shadow);
}
#product.p-product-ui .p-feature-badge.is--open .p-feature-badge__glyph img,
#product.p-product-ui .p-feature-badge__panel-icon img {
    filter: brightness(0) invert(1) drop-shadow(0 0 0 var(--p-white));
    opacity: 1;
}
#product.p-product-ui .p-feature-badge::after {
    content: '';
    position: absolute;
    top: calc(50% - 5px);
    left: calc(100% + 7px);
    z-index: 3;
    width: 10px;
    height: 10px;
    background: var(--p-white);
    opacity: 0;
    transform: translateX(-4px) rotate(45deg);
    transition: opacity 180ms ease-out, transform 180ms cubic-bezier(.16, 1, .3, 1);
    pointer-events: none;
}
#product.p-product-ui .p-feature-badge.is--open::after {
    opacity: 1;
    transform: translateX(0) rotate(45deg);
}
#product.p-product-ui .p-feature-badge__panel {
    position: absolute;
    top: var(--p-badge-panel-shift, 0px);
    left: calc(100% + 12px);
    z-index: 2;
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr);
    column-gap: 12px;
    box-sizing: border-box;
    width: min(290px, var(--p-badge-panel-max-width, calc(100vw - 95px)));
    max-height: min(260px, var(--p-badge-panel-max-height, 300px));
    margin: 0;
    padding: 14px;
    overflow: auto;
    overscroll-behavior: contain;
    border-radius: 17px;
    background: var(--p-white);
    color: var(--p-text);
    box-shadow: 0 8px 26px #0b213c1c;
    opacity: 0;
    transform: translateX(-5px) scale(.98);
    transform-origin: left top;
    transition: opacity 180ms ease-out, transform 180ms cubic-bezier(.16, 1, .3, 1);
    scrollbar-width: thin;
    scrollbar-color: #c9d8e7 transparent;
    pointer-events: none;
}
#product.p-product-ui .p-feature-badge__panel[hidden] { display: none; }
#product.p-product-ui .p-feature-badge.is--open .p-feature-badge__panel {
    opacity: 1;
    transform: translateX(0) scale(1);
    pointer-events: auto;
}
#product.p-product-ui .p-feature-badge__panel-icon {
    position: relative;
    display: block;
    grid-column: 1;
    grid-row: 1 / span 2;
    align-self: start;
    width: 46px;
    height: 46px;
    overflow: hidden;
    border-radius: 50%;
    background: var(--p-badge-gradient);
}
#product.p-product-ui .p-feature-badge__header {
    display: block;
    grid-column: 2;
    min-width: 0;
    padding-right: 19px;
}
#product.p-product-ui .p-feature-badge__title {
    margin: 0;
    font: 700 14px/18px var(--p-font-family);
    letter-spacing: 0;
    overflow-wrap: anywhere;
}
#product.p-product-ui .p-feature-badge__close {
    position: absolute;
    top: 7px;
    right: 7px;
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--p-white);
    color: var(--p-text);
    cursor: pointer;
    touch-action: manipulation;
    transform: translateY(var(--p-badge-close-scroll, 0px));
}
#product.p-product-ui .p-feature-badge__close svg { width: 14px; height: 14px; }
#product.p-product-ui .p-feature-badge__body {
    grid-column: 2;
    min-width: 0;
    margin: 8px 0 0;
    color: var(--p-text-muted);
    font: 400 12px/16px var(--p-font-family);
    overflow-wrap: anywhere;
}
#product.p-product-ui .p-feature-badge :is(button, a):focus-visible {
    outline: 2px solid var(--p-badge-focus);
    outline-offset: 3px;
}
@media (hover: hover) {
    #product.p-product-ui .p-feature-badge__trigger:hover { background-color: #fffffff2; }
    #product.p-product-ui .p-feature-badge__close:hover { background: var(--p-badge-tint); color: var(--p-badge-focus); }
}
@media (max-width: 359px) {
    #product.p-product-ui .p-feature-badge__panel {
        grid-template-columns: 40px minmax(0, 1fr);
        column-gap: 10px;
        padding: 12px;
        border-radius: 16px;
    }
    #product.p-product-ui .p-feature-badge__panel-icon { width: 40px; height: 40px; }
    #product.p-product-ui .p-feature-badge__panel-icon img { width: 62px; height: 62px; }
    #product.p-product-ui .p-feature-badge__header { padding-right: 17px; }
    #product.p-product-ui .p-feature-badge__title { font-size: 13px; line-height: 17px; }
    #product.p-product-ui .p-feature-badge__body { font-size: 11.5px; line-height: 16px; }
}
@media (prefers-reduced-motion: reduce) {
    #product.p-product-ui .p-feature-badge::after,
    #product.p-product-ui .p-feature-badge__panel,
    #product.p-product-ui .p-feature-badge__trigger { transition: none; }
}
