/* Keep descriptions and selection instructions out of the buying controls. */
body.single-product .wp-block-column:has(> form.onno-picker) > .wp-block-post-excerpt,
body.single-product .summary:has(> form.onno-picker) > .woocommerce-product-details__short-description,
form.onno-picker > h3:first-of-type,
form.onno-picker > h3:first-of-type + p {
  display: none !important;
}

form.onno-picker.opq-styled .onno-stepper.opq-closed > :not(.opq-add),
form.onno-picker.opq-styled .onno-stepper > .opq-add[hidden] {
  display: none !important;
}
form.onno-picker.opq-styled .onno-stepper.opq-closed {
  display: flex;
  justify-content: center;
}
form.onno-picker.opq-styled .onno-stepper > button.opq-add {
  width: auto;
  min-width: 64px;
  min-height: 44px;
  padding: .35rem .85rem;
  border: 1px solid #dc6034;
  border-radius: 999px;
  background: #dc6034;
  color: #21140e;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
form.onno-picker.opq-styled .onno-stepper > button.opq-add:focus-visible {
  outline: 2px solid #21140e;
  outline-offset: 3px;
}

form.onno-picker.opq-styled .onno-choice-heading,
form.onno-picker.opq-styled .onno-choice {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(4.5rem, .62fr) minmax(8.25rem, .9fr);
  align-items: center;
  gap: .35rem;
  margin: 0;
  padding: .85rem .5rem;
  text-align: center;
  border: 1px solid #e0e2e7;
  border-radius: 0;
  box-shadow: none;
}
form.onno-picker.opq-styled .onno-choice-heading {
  background: #f6f6f7;
  border-radius: .65rem .65rem 0 0;
  font-weight: 700;
}
form.onno-picker.opq-styled .onno-choice {
  border-top: 0;
  background: #fff;
}
form.onno-picker.opq-styled .onno-choice.selected {
  background: #f6f6f7;
}
form.onno-picker.opq-styled .onno-choice:last-child {
  border-radius: 0 0 .65rem .65rem;
}
form.onno-picker.opq-styled .onno-choice-name {
  min-width: 0;
  justify-content: center;
  overflow-wrap: anywhere;
}
form.onno-picker.opq-styled .onno-stepper {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: clamp(.2rem, 1vw, .6rem);
}
form.onno-picker.opq-styled .onno-stepper > button.opq-add {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: .45rem;
  min-width: 5.6rem;
}
form.onno-picker.opq-styled .onno-stepper > button.opq-add::before {
  content: '';
  width: 1.25rem;
  height: 1.25rem;
  background: currentColor;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 3h3l3 13h11l3-9H6'/%3E%3Ccircle cx='9' cy='21' r='1'/%3E%3Ccircle cx='18' cy='21' r='1'/%3E%3C/svg%3E") center / contain no-repeat;
}
form.onno-picker.opq-styled .onno-stepper > button[data-step]:not(.opq-add) {
  width: 2.4rem;
  height: 2.4rem;
  min-width: 2.4rem;
  padding: 0;
  border: 1px solid #dc6034;
  border-radius: 50%;
  background: #dc6034;
  color: #21140e;
  font-size: 1.3rem;
  line-height: 1;
}
form.onno-picker.opq-styled .onno-stepper > button[data-step="-1"] {
  background: #fff;
}
form.onno-picker.opq-styled .onno-stepper > input[type="number"] {
  width: 2.2rem;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: .5rem;
  background: #f6f6f7;
  box-shadow: 0 1px 3px #0001;
  text-align: center;
  font-weight: 700;
  appearance: textfield;
}
form.onno-picker.opq-styled .onno-stepper > input::-webkit-inner-spin-button,
form.onno-picker.opq-styled .onno-stepper > input::-webkit-outer-spin-button {
  appearance: none;
  margin: 0;
}

/* Override the existing picker's boxed controls on variable products. */
form.onno-picker.opq-styled .onno-stepper {
  border: 0;
  border-radius: 0;
  height: auto;
  min-height: 48px;
  overflow: visible;
  background: transparent;
}
form.onno-picker.opq-styled .onno-stepper:not(.opq-closed) > button:not([hidden]) {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  min-width: 44px !important;
  min-height: 44px;
  color: #21140e !important;
  background: #dc6034 !important;
  border: 1px solid #dc6034 !important;
}
form.onno-picker.opq-styled .onno-stepper > button[data-step]:not(.opq-add) {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
}
form.onno-picker.opq-styled .onno-stepper:not(.opq-closed) > button[data-step="-1"]:not([hidden]) {
  background: #fff !important;
}
form.onno-picker.opq-styled .onno-stepper > button.opq-add:not([hidden]) {
  min-width: 5.6rem !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  color: #21140e !important;
  background: #dc6034 !important;
  border: 1px solid #dc6034 !important;
  padding-inline: .65rem !important;
}
form.onno-picker.opq-styled .onno-stepper > input[type="number"] {
  width: 2rem !important;
  height: 44px;
  background: #f6f6f7 !important;
}
@container (max-width: 300px) {
  form.onno-picker.opq-styled:not(.opq-photo-options) .onno-choice-heading {
    display: none;
  }
  form.onno-picker.opq-styled:not(.opq-photo-options) .onno-choice {
    grid-template-columns: minmax(0, 1fr) 8.25rem;
    text-align: start;
    padding: .65rem;
  }
  form.onno-picker.opq-styled:not(.opq-photo-options) .onno-choice:first-child {
    border-top: 1px solid #e0e2e7;
    border-radius: .65rem .65rem 0 0;
  }
  form.onno-picker.opq-styled:not(.opq-photo-options) .onno-choice:only-child {
    border-radius: .65rem;
  }
  form.onno-picker.opq-styled:not(.opq-photo-options) .onno-main-choices .onno-choice-name {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
}

/* Hide product category metadata on individual product pages. */
body.single-product .product_meta .posted_in,
body.single-product .wp-block-post-terms.taxonomy-product_cat,
body.single-product .wp-block-woocommerce-product-meta .taxonomy-product_cat {
  display: none !important;
}

/* Photo-first selection: one active size row, independent colour quantities. */
form.onno-picker.opq-photo-options .opq-colour-label { margin: 0 0 .65rem; font-size: 14px; }
form.onno-picker.opq-photo-options .opq-swatches { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 8px; margin-bottom: 16px; }
form.onno-picker.opq-photo-options button.opq-swatch { position: relative; display: block; width: 100%; min-width: 0; padding: 3px; border: 1px solid #dedbd7; border-radius: 10px; background: #fff; aspect-ratio: 1; cursor: pointer; overflow: visible; }
form.onno-picker.opq-photo-options button.opq-swatch img { display: block; width: 100%; height: 100%; aspect-ratio: 1; object-fit: contain; border-radius: 7px; }
form.onno-picker.opq-photo-options button.opq-swatch[aria-pressed="true"] { border: 2px solid #dc6034; padding: 2px; box-shadow: 0 0 0 2px #dc603420; }
form.onno-picker.opq-photo-options button.opq-swatch:focus-visible { outline: 2px solid #21140e; outline-offset: 3px; }
form.onno-picker.opq-photo-options .opq-swatch-count { position: absolute; top: -5px; right: -5px; min-width: 21px; height: 21px; padding: 0 4px; box-sizing: border-box; display: grid; place-items: center; border-radius: 50%; background: #dc6034; color: #21140e; font: 700 12px/1 sans-serif; }
form.onno-picker [hidden] { display: none !important; }
form.onno-picker.opq-photo-options .onno-choice-name > img,
form.onno-picker.opq-photo-options .onno-choice-name > strong { display: none; }
form.onno-picker.opq-photo-options .opq-size { font-weight: 600; white-space: nowrap; font-size: 13px; }
form.onno-picker.opq-photo-options .onno-choice-heading,
form.onno-picker.opq-photo-options .onno-main-choices > .onno-choice { grid-template-columns: minmax(0,1fr) minmax(0,1fr) 132px; padding: .65rem .35rem; font-size: 13px; }
form.onno-picker.opq-photo-options .onno-main-choices > .onno-choice { border-radius: 0 0 .65rem .65rem; }


/* Preview buttons never select an item or become disabled at a stock limit. */
form.onno-picker.opq-styled .onno-choice { cursor: default; }
form.onno-picker.opq-styled button.opq-preview {
  display: block; flex: 0 0 48px; width: 48px; min-width: 48px; height: 48px;
  padding: 0; margin: 0; border: 0; border-radius: 8px; background: transparent;
  box-shadow: none; cursor: zoom-in; overflow: hidden;
}
form.onno-picker.opq-styled button.opq-preview img {
  display: block; width: 100%; height: 100%; object-fit: contain; margin: 0;
}
form.onno-picker.opq-styled button.opq-preview:focus-visible {
  outline: 2px solid #dc6034; outline-offset: 3px;
}
form.onno-picker.opq-photo-options .onno-main-choices button.opq-preview { display: none; }
form.onno-picker.opq-photo-options .opq-extra-row .onno-choice-name > strong { display: block; }
form.onno-picker.opq-styled .opq-extra-row:last-of-type { border-radius: 0 0 .65rem .65rem; }
body.opq-preview-open { overflow: hidden; }
dialog.opq-image-dialog {
  box-sizing: border-box; position: fixed; inset: 0; margin: auto; padding: 20px;
  width: min(760px, calc(100vw - 24px)); max-width: calc(100vw - 24px);
  max-height: calc(100dvh - 24px); overflow: auto; border: 0; border-radius: 14px;
  background: #fff; color: #21140e; text-align: center; box-shadow: 0 20px 70px #0005;
}
dialog.opq-image-dialog::backdrop { background: rgba(0,0,0,.75); }
dialog.opq-image-dialog .opq-preview-photo {
  display: block; width: 100%; height: auto; max-height: calc(100dvh - 150px);
  object-fit: contain; margin: 0 auto 12px; border-radius: 8px;
}
dialog.opq-image-dialog .opq-preview-close {
  position: sticky; top: 0; float: right; z-index: 1; display: grid; place-items: center;
  width: 44px; height: 44px; min-width: 44px; margin: 0 0 -44px; padding: 0;
  border: 1px solid #e0e2e7; border-radius: 50%; background: #fff; color: #21140e;
  font: 28px/1 sans-serif; cursor: pointer; box-shadow: 0 2px 6px #0002;
}
dialog.opq-image-dialog #opq-preview-name { margin: 8px 0 4px; font-weight: 700; }
dialog.opq-image-dialog .opq-preview-price { margin: 0; font-weight: 600; color: #dc6034; }
