/* Mobile-only variation selectors (Stage 1; server-rendered since Stage 4). Nothing here applies at 768px and above.
   The swatches and flavour row are printed by PHP. The :has() rules style them from first paint; the
   .hv-row-* / .hv-fl-td classes the script adds do the same job in browsers without :has(). */
.hv-sw,.hv-fl{display:none}

@media (max-width:767px){
  /* hide the ddSlick dropdown, the "Select Colour/Flavour" label and the Clear link on the main form only */
  .single-product form.variations_form:not(.commercekit_sticky-atc) tr:has(.hv-sw) .dd-container,
  .single-product form.variations_form:not(.commercekit_sticky-atc) tr:has(.hv-fl) .dd-container,
  .single-product form.variations_form:not(.commercekit_sticky-atc) tr:has(.hv-sw) th.label,
  .single-product form.variations_form:not(.commercekit_sticky-atc) tr:has(.hv-fl) th.label,
  .single-product form.variations_form:not(.commercekit_sticky-atc) tr:has(.hv-sw) .reset_variations,
  .single-product form.variations_form:not(.commercekit_sticky-atc) tr:has(.hv-fl) .reset_variations{display:none!important}
  .single-product form.variations_form:not(.commercekit_sticky-atc) tr.hv-row-colour .dd-container,
  .single-product form.variations_form:not(.commercekit_sticky-atc) tr.hv-row-flavour .dd-container,
  .single-product form.variations_form:not(.commercekit_sticky-atc) tr.hv-row-colour th.label,
  .single-product form.variations_form:not(.commercekit_sticky-atc) tr.hv-row-flavour th.label,
  .single-product form.variations_form:not(.commercekit_sticky-atc) tr.hv-row-colour .reset_variations,
  .single-product form.variations_form:not(.commercekit_sticky-atc) tr.hv-row-flavour .reset_variations{display:none!important}
  /* swatches need the script, so the native colour <select> only gives way once the early inline script has run */
  html.hv-m-js .single-product form.variations_form:not(.commercekit_sticky-atc) tr:has(.hv-sw) select{display:none!important}
  html.hv-m-js .single-product form.variations_form:not(.commercekit_sticky-atc) tr.hv-row-colour select{display:none!important}

  /* ── colour swatches ── */
  .single-product form.variations_form:not(.commercekit_sticky-atc) .hv-sw{display:block}
  .hv-sw-label{font-size:.8rem;font-weight:600;color:#374151;margin:0 0 8px;line-height:1.3}
  .hv-sw-label span{font-weight:400;color:#111827}
  /* Crop: --hv-sw-zoom (how far in), --hv-sw-x / --hv-sw-y (where the device is in the image, % across / % down).
     Set on <body> per brand from PHP (hv_swatch_crop filter in functions.php); the var() fallbacks are a centre crop. */
  .hv-sw-grid{display:flex;flex-wrap:wrap;gap:10px}
  .hv-sw-btn{width:44px;height:44px;border-radius:50%;border:1px solid #d1d5db;background-color:#f3f4f6;background-repeat:no-repeat;background-size:calc(var(--hv-sw-zoom,2.5)*100%);
    background-position:calc((var(--hv-sw-zoom,2.5)*var(--hv-sw-x,50%) - 50%)/(var(--hv-sw-zoom,2.5) - 1)) calc((var(--hv-sw-zoom,2.5)*var(--hv-sw-y,55%) - 50%)/(var(--hv-sw-zoom,2.5) - 1));padding:0;margin:0;
    font:600 .9rem/1 'Inter',sans-serif;color:#6b7280;position:relative;cursor:pointer;-webkit-tap-highlight-color:transparent;flex:0 0 44px;overflow:hidden}
  .hv-sw-btn.is-sel{box-shadow:0 0 0 2px #fff,0 0 0 4px #111827;border-color:#fff}
  .hv-sw-btn.is-oos{opacity:.4}
  .hv-sw-btn.is-oos::after{content:'';position:absolute;left:-6px;right:-6px;top:50%;height:2px;background:#374151;transform:rotate(-45deg)}
  .hv-sw-btn:focus-visible{outline:2px solid #098cde;outline-offset:3px}

  /* ── flavour row: styled row with the real <select> laid invisibly on top (opens the native picker) ── */
  .single-product form.variations_form:not(.commercekit_sticky-atc) td:has(> .hv-fl){position:relative}
  td.hv-fl-td{position:relative}
  .single-product form.variations_form:not(.commercekit_sticky-atc) .hv-fl{display:flex;align-items:center;gap:12px;min-height:56px;border:1px solid #d1d5db;border-radius:10px;padding:8px 14px;background:#fff;box-sizing:border-box}
  /* flavour products show the whole variation image, no crop or zoom (the device crop is for colour swatches only) */
  .hv-fl-img{display:none;width:40px;height:40px;border-radius:8px;flex:0 0 40px;background:#fff center/contain no-repeat}
  .hv-fl.has-val .hv-fl-img{display:block}
  .hv-fl-text{flex:1 1 auto;min-width:0;font-size:.95rem;color:#6b7280;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .hv-fl.has-val .hv-fl-text{color:#111827;font-weight:500}
  .hv-fl-chev{font-size:1.5rem;line-height:1;color:#6b7280}
  .single-product form.variations_form:not(.commercekit_sticky-atc) td:has(> .hv-fl) select{display:block!important;position:absolute;inset:0;width:100%;height:100%;margin:0;opacity:0;z-index:2;-webkit-appearance:none;appearance:none}
  .single-product form.variations_form.dds-ready td.hv-fl-td select,
  .single-product form.variations_form td.hv-fl-td select{display:block!important;position:absolute;inset:0;width:100%;height:100%;margin:0;opacity:0;z-index:2;-webkit-appearance:none;appearance:none}
}
